/* ============ 主题变量（深蓝经典） ============ */
:root {
  --primary:#1a1a2e;
  --primary-2:#2d2d52;
  --primary-hi:#24315c;
  --primary-hi-2:#3a3a66;
  --accent:#4f6ef7;
  --accent-soft:#eef1fe;
  --accent-rgb:79,110,247;
  --shadow-rgb:15,20,50;
  --header-1:#12122a;
  --header-2:#1a1a2e;
  --header-3:#24315c;
  --bg:#eef1f7;
  --bg-grad:#f3f6fc;
  --ink:#1f2433;
  --muted:#4a5468;
  --line:#e6eaf2;
  --input-border:#d4dae6;
  --input-hover:#b8c1d6;
  --tab-track:#e3e9f4;
  --hover-bg:#f4f6fc;
  --success:#1a9e5c;
  --warning:#e67e22;
  --danger:#dc3545;
  /* 字号标尺 */
  --fs-xs:11px; --fs-sm:12px; --fs-base:13px; --fs-md:14px; --fs-lg:16px; --fs-xl:18px;
}
/* 天蓝 */
html[data-theme="sky"] {
  --primary:#0b72c7;
  --primary-2:#1a8ce0;
  --primary-hi:#0f8ce8;
  --primary-hi-2:#35a8f5;
  --accent:#22a6f0;
  --accent-soft:#e7f4fe;
  --accent-rgb:34,166,240;
  --shadow-rgb:10,60,110;
  --header-1:#07518f;
  --header-2:#0b72c7;
  --header-3:#1a8ce0;
  --bg:#eef6fc;
  --bg-grad:#f0f9ff;
  --muted:#3d5a76;
  --line:#e3effa;
  --input-border:#c8ddec;
  --input-hover:#9cc7e4;
  --tab-track:#dceaf5;
  --hover-bg:#eff7fd;
}
/* 翡翠绿 */
html[data-theme="emerald"] {
  --primary:#0f6e5a;
  --primary-2:#149174;
  --primary-hi:#128a6d;
  --primary-hi-2:#1db38e;
  --accent:#1a9e8a;
  --accent-soft:#e6f7f2;
  --accent-rgb:26,158,138;
  --shadow-rgb:10,70,60;
  --header-1:#0a5747;
  --header-2:#0f6e5a;
  --header-3:#149174;
  --bg:#eef8f5;
  --bg-grad:#f1fbf7;
  --muted:#3d6a5f;
  --line:#e0f0ea;
  --input-border:#c9e2da;
  --input-hover:#9fcbbf;
  --tab-track:#dcefe9;
  --hover-bg:#effaf6;
}
/* 活力紫 */
html[data-theme="violet"] {
  --primary:#4c3a9e;
  --primary-2:#6a53c7;
  --primary-hi:#5b46ba;
  --primary-hi-2:#7e6ad4;
  --accent:#7c6cf0;
  --accent-soft:#f0edfe;
  --accent-rgb:124,108,240;
  --shadow-rgb:40,30,100;
  --header-1:#34206f;
  --header-2:#4c3a9e;
  --header-3:#6a53c7;
  --bg:#f3f1fc;
  --bg-grad:#f6f4ff;
  --muted:#5a5480;
  --line:#e9e5f5;
  --input-border:#d4cdec;
  --input-hover:#b0a5e0;
  --tab-track:#e7e2f5;
  --hover-bg:#f5f3fe;
}
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:'Microsoft YaHei','微软雅黑',sans-serif; background:linear-gradient(180deg,var(--bg-grad) 0%, var(--bg) 260px); background-attachment:fixed; color:var(--ink); min-height:100vh; }
::selection { background:rgba(var(--accent-rgb),0.18); }
::-webkit-scrollbar { width:10px; height:10px; }
::-webkit-scrollbar-thumb { background:#c6cde0; border-radius:6px; }
::-webkit-scrollbar-thumb:hover { background:#9aa4bf; }
::-webkit-scrollbar-track { background:transparent; }

.header { background:var(--primary); color:#fff; padding:14px 28px; display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid rgba(255,255,255,.08); box-shadow:none; }
.header-right { display:flex; align-items:center; gap:16px; }
.header-user { display:flex; align-items:center; gap:10px; }
.header-user span { font-size:12px; opacity:0.85; }
.header-user button { border:1px solid rgba(255,255,255,0.45); background:transparent; color:#fff; border-radius:8px; padding:4px 10px; font-size:12px; cursor:pointer; font-family:inherit; }
.header-user button:hover { background:rgba(255,255,255,0.12); }
.header h1 { font-size:20px; font-weight:600; letter-spacing:.5px; }
.header .subtitle { font-size:13px; opacity:0.7; }
.container { max-width:none; margin:0; padding:20px; }
/* 共用操作区随剩余屏宽展开；min-width:0 保证表格不会撑宽手机页面。 */
.app-body > .container { width:100%; min-width:0; }

/* 工艺切换 */
.type-tabs { display:flex; gap:8px; margin-bottom:24px; border-radius:12px; background:var(--tab-track); padding:4px; box-shadow:inset 0 1px 3px rgba(var(--shadow-rgb),0.06); }
/* 左侧深色侧边导航（阿里/字节业务系统风） */
.app-body { display:flex; align-items:stretch; }
.sidenav { width:216px; flex-shrink:0; background:linear-gradient(180deg,var(--primary) 0%, var(--primary-2) 140%); color:#fff; position:sticky; top:0; height:100vh; overflow-y:auto; z-index:20; display:flex; flex-direction:column; }
.sidenav-brand, .sidenav-items { flex:0 0 auto; }
.sidenav-brand { padding:24px 20px 18px; border-bottom:1px solid rgba(255,255,255,.12); }
.sidenav-brand-main { font-size:14px; font-weight:600; color:#fff; letter-spacing:0; line-height:1.4; white-space:nowrap; }
.sidenav-brand-sub { font-size:11px; opacity:.6; margin-top:4px; letter-spacing:1px; }
.sidenav-items { padding:12px 12px 24px; display:flex; flex-direction:column; gap:2px; }
.sidenav-group { font-size:11px; color:rgba(255,255,255,.45); letter-spacing:1px; margin:16px 8px 6px; }
.sidenav-item { display:block; padding:11px 14px; border-radius:8px; font-size:14px; font-weight:500; color:rgba(255,255,255,.82); cursor:pointer; transition:all .18s; border-left:3px solid transparent; }
.sidenav-item:hover { background:rgba(255,255,255,.08); color:#fff; }
.sidenav-item.active { background:var(--accent); border-left-color:rgba(255,255,255,.8); color:#fff; box-shadow:0 4px 12px rgba(var(--shadow-rgb),.35); }
.header-title { font-size:19px; font-weight:600; color:#fff; letter-spacing:.5px; opacity:1; }
/* 超期提醒：三列逐行，避免挤成一段流式文本把「交期已过2天」折断 */
.overdue-box { margin-top:12px; border:1px solid #f0d48a; border-left:3px solid var(--warning); border-radius:8px; background:#fffaf0; overflow:hidden; }
.overdue-head { padding:9px 14px; font-size:var(--fs-base); font-weight:600; color:#8a6100; background:rgba(230,126,34,.08); border-bottom:1px solid #f3e0b5; }
.overdue-list { padding:4px 0; }
.overdue-row { display:flex; align-items:center; gap:12px; padding:6px 14px; font-size:var(--fs-sm); }
.overdue-row + .overdue-row { border-top:1px solid rgba(230,126,34,.10); }
/* 整行可点：跳到下面跟单概览里的这张单。手机上行高放宽到 40px，别做成戳不中的细条。 */
.overdue-row.is-clickable, .overdue-more.is-clickable { cursor:pointer; transition:background .15s; }
.overdue-row.is-clickable:hover, .overdue-more.is-clickable:hover { background:rgba(230,126,34,.10); }
.overdue-row.is-clickable:focus-visible, .overdue-more.is-clickable:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.overdue-row.is-clickable .overdue-no { color:var(--primary); text-decoration:underline; text-decoration-color:rgba(230,126,34,.45); text-underline-offset:2px; }
.overdue-no { flex:none; width:130px; font-weight:600; color:var(--ink); font-variant-numeric:tabular-nums; }
.overdue-product { flex:1; min-width:0; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.overdue-days { flex:none; color:var(--danger); font-weight:600; white-space:nowrap; }
.overdue-more { padding:6px 14px; font-size:var(--fs-sm); color:var(--muted); }
@media (max-width:700px) { .overdue-no { width:auto; } .overdue-row { flex-wrap:wrap; gap:4px 10px; } .overdue-product { flex-basis:100%; order:3; } .overdue-row.is-clickable, .overdue-more.is-clickable { min-height:40px; padding:8px 14px; } }
.type-tab { flex:1; padding:10px 12px; text-align:center; cursor:pointer; background:transparent; border:none; border-radius:9px; font-size:15px; font-weight:500; color:var(--muted); transition:all 0.2s; }
.type-tab:hover { background:rgba(255,255,255,0.7); color:var(--primary); }
.type-tab.active { background:linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%); color:#fff; box-shadow:0 3px 10px rgba(var(--shadow-rgb),0.35); }

/* 表单卡片 */
.card { background:#fff; border-radius:12px; padding:24px; margin-bottom:16px; border:1px solid rgba(var(--shadow-rgb),0.05); box-shadow:0 1px 2px rgba(var(--shadow-rgb),0.05), 0 6px 18px rgba(var(--shadow-rgb),0.06); }
.card-title { font-size:16px; font-weight:600; margin-bottom:16px; padding-bottom:10px; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:8px; color:var(--primary); }
.card-title::before { content:''; display:inline-block; width:4px; height:18px; background:linear-gradient(180deg, var(--accent) 0%, var(--primary) 100%); border-radius:3px; }
.card-title .ct-ico { width:16px; height:16px; flex:none; opacity:.8; color:var(--accent); }
.fin-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; align-items:start; margin-bottom:16px; }
.fin-grid-2 > .card { margin-bottom:0; }
@media (max-width: 900px) { .fin-grid-2 { grid-template-columns:1fr; } }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px 24px; }
.form-group { display:flex; flex-direction:column; gap:4px; }
.form-group.full { grid-column:1/-1; }
.form-group label { font-size:13px; font-weight:500; color:var(--muted); }
.form-group input, .form-group select, .form-group textarea {
  padding:8px 12px; border:1px solid var(--input-border); border-radius:8px; font-size:14px;
  font-family:inherit; background:#fff; transition:border-color 0.2s, box-shadow 0.2s; outline:none;
}
.form-group input:hover, .form-group select:hover, .form-group textarea:hover { border-color:var(--input-hover); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(var(--accent-rgb),0.14); }
.form-group textarea { resize:vertical; min-height:60px; }

/* 一模多款：每款一张编号卡片；首款只保留一个产品名称输入框。 */
.order-products-count{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;color:var(--muted);font-size:12px}
.order-products-count strong{font-size:15px;color:var(--ink)}
.order-product-card{min-width:0;margin-top:8px;padding:12px;border:1px solid var(--input-border);border-radius:10px;background:var(--surface,#fff)}
.order-product-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:9px}
.order-product-index{display:inline-flex;align-items:center;padding:3px 9px;border-radius:999px;background:var(--accent-soft);color:var(--primary);font-size:12px;font-weight:700}
.order-product-card>label{font-size:12px;font-weight:600;color:var(--muted)}
.order-product-card>input{width:100%;box-sizing:border-box}
.order-product-meta{display:grid;grid-template-columns:minmax(0,1fr) minmax(110px,.4fr);gap:10px;margin-top:9px}
.order-product-meta label{display:block;min-width:0;font-size:12px;font-weight:600;color:var(--muted)}
.order-product-meta input{display:block;width:100%;box-sizing:border-box;margin-top:5px}
.mold-output-del{padding:4px 7px;border:0;background:transparent;color:#c0392b;font:12px inherit;cursor:pointer}
.mold-output-del:hover{text-decoration:underline}
@media(max-width:480px){.order-product-card{padding:10px}.order-product-meta{grid-template-columns:minmax(0,1fr) 100px;gap:8px}}

/* 按钮 */
.btn-row { display:flex; gap:10px; margin-top:8px; flex-wrap:wrap; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:5px; min-width:0; min-height:40px; padding:9px 18px; border:none; border-radius:8px; font-size:14px; line-height:1.25; font-weight:600; white-space:nowrap; cursor:pointer; font-family:inherit; transition:all 0.2s; box-shadow:0 1px 2px rgba(var(--shadow-rgb),0.08); }
.btn:hover { transform:translateY(-1px); box-shadow:0 5px 14px rgba(var(--shadow-rgb),0.16); }
.btn:active { transform:translateY(0); }
.btn-primary { background:linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%); color:#fff; }
.btn-primary:hover { background:linear-gradient(135deg, var(--primary-hi) 0%, var(--primary-hi-2) 100%); }
.btn-success { background:linear-gradient(135deg, #14804b 0%, var(--success) 100%); color:#fff; }
.btn-success:hover { background:linear-gradient(135deg, var(--success) 0%, #20b871 100%); }
.btn-outline { background:#fff; color:var(--primary); border:1px solid var(--input-border); box-shadow:none; }
.btn-outline:hover { background:var(--accent-soft); border-color:var(--accent); transform:none; box-shadow:none; }
.btn-warning { background:linear-gradient(135deg, #d35400 0%, var(--warning) 100%); color:#fff; }
.btn-warning:hover { background:linear-gradient(135deg, var(--warning) 0%, #f0932b 100%); }
.btn-danger { background:linear-gradient(135deg, #c0392b 0%, var(--danger) 100%); color:#fff; }
.btn-danger:hover { background:linear-gradient(135deg, var(--danger) 0%, #e74c3c 100%); }
.btn-sm { min-height:30px; padding:4px 10px; font-size:12px; border-radius:6px; }
.btn-quiet-danger { color:var(--muted); border-color:var(--input-border); font-weight:500; }
.btn-quiet-danger:hover { background:rgba(220,53,69,.08); border-color:var(--danger); color:var(--danger); }
.card table .btn-danger.btn-sm { background:transparent; color:var(--muted); border:1px solid var(--input-border); box-shadow:none; font-weight:500; }
.card table .btn-danger.btn-sm:hover { background:rgba(220,53,69,.08); border-color:var(--danger); color:var(--danger); }
.btn:disabled { opacity:0.5; cursor:not-allowed; transform:none !important; box-shadow:none !important; }
.ui-toolbar { display:flex; align-items:center; gap:8px 10px; flex-wrap:wrap; }
.ui-toolbar > input, .ui-toolbar > select { min-width:0; }
.ui-action-group { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
/* 按钮组不吊在右边：筛选和按钮同属一条工具栏，放得下就接着排，
   放不下就整组落到第二行、左边跟筛选对齐，读起来是连续的两行。
   以前用 margin-left:auto 顶到最右，换行后跟左边的筛选断开，中间一大片空。 */
.fin-toolbar-actions { margin-left:0; }
.fin-toolbar-actions .btn { padding:6px 14px; font-size:13px; }

/* 概览卡片：固定列数的等宽网格。原来是 flex + wrap，五张卡排成 4+1，
   最后一张孤零零占一行。这里的可用宽度是 870px（960 容器减内边距），
   五张卡各 174px、去掉内边距还剩 146px，装得下最长的「¥ 439,362.83」（135px）。
   auto-fit + minmax 试过，168px 的下限要 888px 才够五列，正好差一点点，
   于是又退回四列 —— 所以直接写死列数，宽屏一定是齐整的一行。 */
.fin-summary { display:grid; gap:10px; font-size:14px;
  grid-template-columns:repeat(5, minmax(0, 1fr)); }
.fin-sum-card { padding:11px 14px; border:1px solid var(--line, #e5e7eb); border-radius:8px;
  background:#f8f9fa; min-width:0; }
.fin-sum-card .fin-sum-label { font-size:12px; color:#666; white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis; }
.fin-sum-card .fin-sum-label span { color:#9aa3af; font-weight:400; font-size:11px; }
.fin-sum-card .fin-sum-value { font-size:19px; font-weight:700; margin-top:3px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; letter-spacing:-0.2px; }
/* 提示条横跨整行，不参与均分 */
.fin-summary .fin-summary-note { grid-column:1 / -1; }
@media (max-width: 860px) {
  .fin-summary { grid-template-columns:repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .fin-summary { grid-template-columns:repeat(2, minmax(0, 1fr)); gap:8px; }
  .fin-sum-card { padding:10px 12px; }
  .fin-sum-card .fin-sum-value { font-size:17px; }
}
.fin-flt { display:flex; align-items:center; gap:6px; }
.fin-flt-label { font-size:13px; color:#666; white-space:nowrap; }
.fin-flt-btns { display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
.fin-flt-btns button { padding:5px 13px; border:1px solid var(--primary); border-radius:4px; cursor:pointer; font-size:12px; background:#fff; color:var(--primary); font-family:inherit; line-height:1.3; }
.table-actions { display:flex; align-items:center; justify-content:center; gap:4px; white-space:nowrap; }
.table-actions .btn { min-height:28px; padding:3px 7px; font-size:11px; }
.history-actions { display:flex; align-items:center; justify-content:flex-end; gap:5px; flex:none; }
.history-actions .btn { min-height:30px; margin:0 !important; padding:4px 9px !important; font-size:12px !important; }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; flex-wrap:wrap; margin-top:16px; }
.order-action-bar { position:sticky; bottom:10px; z-index:30; display:flex; align-items:center; gap:9px; margin:4px 0 18px; padding:10px; border:1px solid rgba(var(--shadow-rgb),.08); border-radius:12px; background:#fff; box-shadow:0 8px 24px rgba(var(--shadow-rgb),.14); }
.order-action-bar .btn { min-height:40px; }
.action-menu { position:relative; }
.action-menu > summary { list-style:none; user-select:none; }
.action-menu > summary::-webkit-details-marker { display:none; }
.action-menu-panel { position:absolute; right:0; bottom:calc(100% + 7px); z-index:40; width:180px; padding:6px; border:1px solid var(--line); border-radius:10px; background:#fff; box-shadow:0 14px 34px rgba(var(--shadow-rgb),.2); }
.action-menu-panel button { width:100%; border:0; border-radius:7px; background:#fff; color:var(--ink); padding:9px 10px; text-align:left; font-family:inherit; font-size:13px; cursor:pointer; }
.action-menu-panel button:hover { background:var(--hover-bg); color:var(--primary); }
.action-menu-panel button.danger { color:#b91c1c; }
.track-card { margin-bottom:10px; border:1px solid #dfe5ee; border-left:4px solid #94a3b8; border-radius:10px; background:#fff; overflow:hidden; box-shadow:0 1px 3px rgba(var(--shadow-rgb),.06); }
.track-card.type-injection { border-left-color:#e67e22; }
.track-card.type-board { border-left-color:#2980b9; }
.track-card:nth-child(even) .track-row { background:#f7f9fc; }
.track-row { display:flex; align-items:center; flex-wrap:wrap; gap:5px 8px; padding:12px 13px; font-size:13px; cursor:pointer; transition:background .15s, box-shadow .15s; }
.track-row:hover { background:#eef3fb !important; box-shadow:inset 0 0 0 1px rgba(var(--accent-rgb),.12); }
.track-detail { padding:14px; background:#f8fafc; border-top:1px solid #e5e7eb; font-size:13px; }
.track-info-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px 22px; }
.track-section { grid-column:1/-1; margin-top:4px; padding:11px 12px; border:1px solid #e2e8f0; border-radius:9px; background:#fff; }
.track-section-title { margin-bottom:8px; color:var(--primary); font-size:12px; font-weight:700; }
.track-inline-form { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.track-inline-form input { padding:5px 7px; border:1px solid var(--input-border); border-radius:6px; font-family:inherit; }
.track-detail-toggle { margin-left:4px; font-size:11px; color:#64748b; }
/* 逐件良品点数：一模多件时每件一行，模数只作参考 */
.track-part-hint { margin-bottom:7px; color:#64748b; font-size:12px; line-height:1.6; }
.track-part-rows { display:grid; gap:6px; }
.track-part-row { display:grid; grid-template-columns:minmax(120px,1.3fr) 160px 152px minmax(0,1.1fr); align-items:center; gap:10px; padding:7px 9px; border:1px solid #e8eef6; border-radius:8px; background:#fafcff; }
.track-part-name { font-size:13px; font-weight:600; }
.track-part-expect { color:#64748b; font-size:12px; white-space:nowrap; }
.track-part-input { font-size:13px; white-space:nowrap; }
.track-part-input input { width:96px; padding:5px 7px; border:1px solid var(--input-border); border-radius:6px; font-family:inherit; }
.track-part-note { color:#64748b; font-size:12px; }
.dashboard-hero { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:14px; padding:20px; border-radius:14px; color:#fff; background:linear-gradient(180deg,var(--primary) 0%, var(--primary-2) 130%); box-shadow:0 6px 20px rgba(var(--shadow-rgb),.16); }
.dashboard-hero h2 { font-size:21px; margin-bottom:5px; }
.dashboard-hero p { color:rgba(255,255,255,.76); font-size:13px; }
.dashboard-role { flex:none; padding:5px 11px; border:1px solid rgba(255,255,255,.3); border-radius:999px; background:rgba(255,255,255,.12); font-size:12px; }
.dashboard-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:14px; }
.dashboard-metric { appearance:none; border:1px solid rgba(var(--shadow-rgb),.07); border-radius:12px; background:#fff; padding:14px; text-align:left; font-family:inherit; color:var(--ink); box-shadow:0 3px 12px rgba(var(--shadow-rgb),.07); cursor:pointer; }
.dashboard-metric:hover { border-color:var(--accent); transform:translateY(-1px); }
.dashboard-metric span { display:block; color:#64748b; font-size:12px; margin-bottom:5px; }
.dashboard-metric strong { display:block; color:var(--primary); font-size:24px; line-height:1.1; }
.dashboard-metric small { display:block; color:#94a3b8; font-size:11px; margin-top:5px; }
.dashboard-metric.danger strong { color:#b91c1c; }.dashboard-metric.warning strong { color:#c2410c; }.dashboard-metric.info strong { color:#1d4ed8; }.dashboard-metric.success strong { color:#15803d; }
.dashboard-grid { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(260px,.65fr); gap:14px; }
.dashboard-grid .card { margin-bottom:0; }
.dashboard-task { display:flex; align-items:center; gap:10px; width:100%; padding:10px 6px; border:0; border-bottom:1px solid var(--line); background:transparent; color:var(--ink); font-family:inherit; text-align:left; cursor:pointer; }
.dashboard-task:last-child { border-bottom:0; }.dashboard-task:hover { background:var(--hover-bg); }
.dashboard-task-main { flex:1; min-width:0; }.dashboard-task-main strong,.dashboard-task-main span { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.dashboard-task-main span { color:#64748b; font-size:12px; margin-top:2px; }
.dashboard-task-status { flex:none; font-size:11px; color:#b91c1c; font-weight:600; }
.dashboard-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.dashboard-action { border:1px solid var(--line); border-radius:10px; background:#fff; color:var(--primary); padding:12px 9px; font-family:inherit; font-weight:600; cursor:pointer; }
.dashboard-action:hover { background:var(--accent-soft); border-color:var(--accent); }

/* 表格单元格内的小输入框（支出备注等） */
.cell-input { padding:3px 10px; border:1px solid var(--input-border); border-radius:6px; font-size:12px; outline:none; transition:border-color .15s, box-shadow .15s; }
.cell-input:hover { border-color:var(--input-hover); }
.cell-input:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(var(--accent-rgb),.14); }

/* 小型筛选胶囊按钮（分类/状态/类型） */
.fbtn { padding:5px 16px; border-radius:999px; cursor:pointer; font-size:12px; font-weight:500; transition:all .15s; background:#fff; }
.fbtn:hover { transform:translateY(-1px); box-shadow:0 2px 8px rgba(var(--shadow-rgb),.12); }
.fbtn:active { transform:translateY(0); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

/* 状态胶囊 */
.status-pill { display:inline-block; margin-left:6px; padding:2px 10px; border-radius:999px; font-size:var(--fs-xs); font-weight:500; }
.status-done { background:rgba(26,158,92,.14); color:var(--success); }
.status-ship { background:rgba(42,91,215,.12); color:#2a5bd7; }
.status-prod { background:rgba(79,110,247,.12); color:var(--accent); }
.status-overdue { background:rgba(220,53,69,.13); color:var(--danger); }
.status-warn { background:rgba(230,126,34,.15); color:var(--warning); }
.status-flag { background:rgba(192,57,43,.12); color:#c0392b; }

/* 历史列表 */
.history-item { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; padding:11px 13px; border:1px solid #dfe5ee; border-left:4px solid #94a3b8; background:#fff; font-size:13px; border-radius:9px; box-shadow:0 1px 3px rgba(var(--shadow-rgb),.05); transition:background .15s, border-color .15s, box-shadow .15s; }
.history-item:nth-child(even) { background:#f7f9fc; }
.history-item.type-injection { border-left-color:#e67e22; }
.history-item.type-board { border-left-color:#2980b9; }
.history-item:hover { background:#eef3fb; border-color:#c8d3e2; box-shadow:0 3px 10px rgba(var(--shadow-rgb),.09); }
.history-item .order-id { font-weight:600; color:var(--primary); min-width:130px; }
.history-item .history-order-link { appearance:none; border:0; background:transparent; padding:4px 0; font:inherit; text-align:left; cursor:pointer; border-radius:4px; }
.history-item .history-order-link:hover { text-decoration:underline; text-underline-offset:3px; }
.history-item .history-order-link:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.history-item .order-info { flex:1; margin:0 16px; color:var(--muted); }
.history-item .order-time { color:#9aa4bf; font-size:12px; white-space:nowrap; margin-right:12px; }
.list-color-legend { display:flex; align-items:center; gap:10px; color:#64748b; font-size:11px; white-space:nowrap; }
.list-color-legend span { display:inline-flex; align-items:center; gap:4px; }
.list-color-legend i { width:4px; height:14px; border-radius:3px; background:#94a3b8; }
.list-color-legend .injection { background:#e67e22; }
.list-color-legend .board { background:#2980b9; }
.empty-state { text-align:center; padding:40px 20px; color:#8a93a8; font-size:14px; border:1px dashed rgba(var(--shadow-rgb),0.14); border-radius:12px; margin:6px 0; background:linear-gradient(180deg, rgba(var(--accent-rgb),0.02) 0%, transparent 100%); }
.empty-state::before { content:''; display:block; width:38px; height:38px; margin:0 auto 12px; opacity:.5; background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a93a8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='22 12 16 12 14 15 10 15 8 12 2 12'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E") center/contain no-repeat; }

/* 卡片内数据表统一排版（供各页数据表对齐；打印/对账单预览区有独立边框规则，不受影响） */
.card table { width:100%; font-size:var(--fs-base); border-collapse:collapse; }
.card table th { text-align:left; font-size:var(--fs-base); font-weight:600; padding:6px 10px; color:var(--muted); background:var(--hover-bg); white-space:nowrap; }
.card table td { font-size:var(--fs-base); padding:9px 10px; border-bottom:1px solid var(--line); vertical-align:middle; }

/* 表格斑马纹 + 行悬停（只作用于卡片内数据表，不污染打印区） */
.card table tr:nth-child(even) { background:rgba(var(--accent-rgb),0.05); }
.inventory-collapse-group{margin:10px 0;border:1px solid #dbe3ec;border-radius:10px;background:#fff;overflow:hidden;box-shadow:0 1px 2px rgba(var(--shadow-rgb),.04)}
.inventory-collapse-group>summary{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:46px;padding:8px 12px;background:#eef3fb;color:#1a56db;cursor:pointer;list-style:none;user-select:none}
.inventory-collapse-group>summary::-webkit-details-marker{display:none}
.inventory-collapse-group>summary span{display:flex;align-items:baseline;gap:10px;min-width:0;flex-wrap:wrap}
.inventory-collapse-group>summary strong{font-size:14px}.inventory-collapse-group>summary small{color:#7c879a;font-size:12px;font-weight:400}
.inventory-collapse-group>summary::after{content:'展开';flex:none;padding:3px 8px;border:1px solid #b9c9df;border-radius:999px;background:#fff;color:#52647d;font-size:11px;font-weight:600}
.inventory-collapse-group[open]>summary::after{content:'收起'}
.inventory-collapse-group.is-uncategorized>summary{background:#f4f4f4;color:#64748b}
.inventory-collapse-body{overflow-x:auto;border-top:1px solid #dbe3ec}
.card table tbody tr { transition:background 0.12s; }
.card table tbody tr:hover { background:rgba(var(--accent-rgb),0.10); }
/* 数据表容器列不折行：宽窗正常铺满，窄窗横向滚动，避免“注塑成型/生产中”被拆成两行 */
#dataTable { overflow-x:auto; }
#dataTable table { min-width:800px; }
#dataTable table th:nth-child(2),
#dataTable table th:nth-child(6),
#dataTable table th:nth-child(7),
#dataTable table th:nth-child(8),
#dataTable table td:nth-child(2),
#dataTable table td:nth-child(6),
#dataTable table td:nth-child(7),
#dataTable table td:nth-child(8) { white-space:nowrap; }

/* Toast */
.toast { position:fixed; top:20px; left:50%; transform:translateX(-50%); background:linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%); color:#fff; padding:11px 26px; border-radius:10px; font-size:14px; z-index:23000; opacity:0; transition:opacity 0.3s; pointer-events:none; border:1px solid rgba(255,255,255,0.12); box-shadow:0 8px 24px rgba(var(--shadow-rgb),0.4); }
.toast.show { opacity:1; }
.toast.success { background:linear-gradient(135deg,#14804b 0%, #20b871 100%); }
.toast.error { background:linear-gradient(135deg,#c0392b 0%, #e74c3c 100%); }

/* PWA 安装入口：只有确认可安装或 iOS 需要手动添加时才显示横幅；菜单入口始终保留作帮助。 */
.pwa-install-banner{display:none;position:fixed;left:50%;bottom:18px;z-index:12100;transform:translateX(-50%);width:min(520px,calc(100vw - 24px));box-sizing:border-box;align-items:center;gap:10px;padding:11px 12px 11px 15px;border:1px solid #bfdbfe;border-radius:13px;background:rgba(255,255,255,.98);box-shadow:0 14px 38px rgba(15,23,42,.22);color:#1e293b}
.pwa-install-banner.show{display:flex}
.pwa-install-banner>div{min-width:0;flex:1}.pwa-install-banner strong,.pwa-install-banner span{display:block}.pwa-install-banner strong{font-size:14px}.pwa-install-banner span{margin-top:2px;color:#64748b;font-size:11px}
.pwa-install-banner button{flex:none;border:0;border-radius:9px;background:#1a56db;color:#fff;padding:8px 13px;font:700 13px/1.2 inherit;cursor:pointer}
.pwa-install-banner .pwa-banner-close{width:30px;height:30px;padding:0;background:#f1f5f9;color:#64748b;font-size:18px}
.pwa-guide-overlay{display:none;position:fixed;inset:0;z-index:22000;align-items:center;justify-content:center;padding:18px;background:rgba(15,23,42,.58)}
.pwa-guide-overlay.show{display:flex}
.pwa-guide-dialog{width:min(420px,100%);overflow:hidden;border-radius:15px;background:#fff;box-shadow:0 24px 70px rgba(15,23,42,.38)}
.pwa-guide-head{display:flex;align-items:center;justify-content:space-between;padding:15px 17px;border-bottom:1px solid #e2e8f0;color:#1e293b}
.pwa-guide-head button{border:0;background:#f1f5f9;color:#64748b;width:30px;height:30px;border-radius:8px;font-size:18px;cursor:pointer}
.pwa-guide-body{padding:16px 18px;color:#475569;font-size:14px;line-height:1.7}.pwa-guide-body ol{margin:8px 0 0;padding-left:22px}.pwa-guide-body p{margin:0 0 8px}.pwa-guide-body .pwa-guide-note{padding:9px 11px;border-radius:8px;background:#fff7ed;color:#9a3412;font-size:12px}
.pwa-guide-ok{display:block;width:calc(100% - 36px);margin:0 18px 18px;padding:10px;border:0;border-radius:9px;background:#1a56db;color:#fff;font:700 14px/1.2 inherit;cursor:pointer}

/* 长页面页内索引：宽屏常驻，窄屏折叠成悬浮按钮。 */
.page-index-fab,.page-index-desktop,.page-index-overlay{display:none}
/* 从缩略图跳到库位后的返回入口。缩略图在页面顶部、库位可能在十几排以下，
   改完卡片要滑很久才回得去。放在「目录」左边，避开手机底部导航。 */
.warehouse-thumb-back{position:fixed;right:14px;bottom:20px;z-index:11900;border:1px solid #fcd34d;border-radius:999px;background:#fffbeb;color:#92400e;padding:9px 14px;box-shadow:0 8px 24px rgba(15,23,42,.22);font:700 13px/1.2 inherit;cursor:pointer}
.warehouse-thumb-back:hover{background:#fef3c7}
@media(max-width:900px){.warehouse-thumb-back{right:auto;left:14px}}
body.app-ready .warehouse-thumb-back{bottom:calc(82px + env(safe-area-inset-bottom))}
@media(min-width:901px){.warehouse-thumb-back{bottom:20px;right:150px}}

.page-index-desktop{position:fixed;right:16px;top:104px;z-index:8500;width:156px;max-height:calc(100vh - 128px);overflow:auto;padding:10px;border:1px solid #dbe4f0;border-radius:12px;background:rgba(255,255,255,.96);box-shadow:0 10px 28px rgba(15,23,42,.12)}
.page-index-desktop.available{display:block}
.page-index-title{display:block;margin:1px 7px 8px;color:#334155;font-size:12px}
.page-index-link,.page-index-edge{display:block;width:100%;border:0;border-radius:8px;background:transparent;color:#64748b;text-align:left;font:600 12px/1.35 inherit;cursor:pointer}
.page-index-link{position:relative;margin:2px 0;padding:7px 8px 7px 18px}
.page-index-link::before{content:"";position:absolute;left:7px;top:50%;width:5px;height:5px;border-radius:50%;background:#cbd5e1;transform:translateY(-50%)}
.page-index-link:hover{background:#eff6ff;color:#1d4ed8}.page-index-link.active{background:#eaf2ff;color:#1d4ed8}.page-index-link.active::before{background:#2563eb;box-shadow:0 0 0 3px #dbeafe}
.page-index-edge{margin-top:7px;padding:8px;border-top:1px solid #e2e8f0;color:#2563eb;text-align:center}
.page-index-target-pulse{animation:pageIndexPulse 1.8s ease-out}
@keyframes pageIndexPulse{0%,100%{box-shadow:inherit}18%,55%{box-shadow:0 0 0 4px rgba(37,99,235,.2),0 10px 28px rgba(37,99,235,.12)}}
/* 目录面板：原来是占满整宽的底部弹层 + 药丸胶囊换行堆，两个毛病 ——
   胶囊宽度不一，换行后没有顺序感，而目录唯一要表达的就是「页面从上到下有哪些段」；
   压暗全屏又正好盖住你想确认的位置。改成贴着右下角「目录」按钮向上弹出的一列，
   跟宽屏那份右侧索引同一种形态，遮罩只留很浅一层用来接「点外面关闭」。
   --pi-anchor 是面板底边要让开的高度（按钮自身高度 + 它离屏幕底的距离 + 间隙）。 */
.page-index-overlay{--pi-anchor:68px;position:fixed;inset:0;z-index:19500;align-items:flex-end;justify-content:flex-end;background:rgba(15,23,42,.18)}
.page-index-overlay.show{display:flex}
.page-index-sheet{width:min(200px,calc(100vw - 28px));max-height:min(66vh,520px);overflow:auto;margin:0 14px var(--pi-anchor);padding:0 10px 10px;border:1px solid #dbe4f0;border-radius:14px;background:#fff;box-shadow:0 14px 40px rgba(15,23,42,.26)}
.page-index-head{position:sticky;top:0;z-index:1;display:flex;align-items:center;padding:10px 2px 8px;border-bottom:1px solid #e2e8f0;background:#fff;color:#1e293b;font-size:13px}
.page-index-mobile-list{display:flex;flex-direction:column;gap:2px;padding:8px 0}
.page-index-mobile-list .page-index-link{display:flex;align-items:center;width:100%;flex:none;margin:0;min-height:40px;padding:9px 10px 9px 22px;border:0;border-radius:9px;background:transparent;font-size:13px;white-space:normal;text-align:left}
.page-index-mobile-list .page-index-link::before{left:9px}.page-index-mobile-list .page-index-link.active{background:#eaf2ff;color:#1d4ed8}
/* 顶部/底部两个按钮改成上下排：并排时它们才是面板宽度的下限，拆成一列后
   面板可以窄到只够放章节名（248px → 200px），张开时没那么占地方。 */
.page-index-actions{display:grid;grid-template-columns:1fr;gap:6px;padding-top:8px;border-top:1px solid #e2e8f0}
.page-index-actions button{min-height:40px;border:1px solid #bfdbfe;border-radius:9px;background:#eff6ff;color:#1d4ed8;padding:8px;font:700 13px/1.2 inherit;cursor:pointer}

@media(max-width:1399px){
  .page-index-desktop.available{display:none}
  .page-index-fab.available{display:flex;position:fixed;right:14px;bottom:20px;z-index:11800;align-items:center;gap:5px;border:1px solid #bfdbfe;border-radius:999px;background:#fff;color:#1d4ed8;padding:9px 13px;box-shadow:0 8px 24px rgba(15,23,42,.2);font:700 13px/1.2 inherit;cursor:pointer}
}

/* 工单跟踪：定位提醒（柔和淡金呼吸，不刺眼） */
@keyframes trackFlash {
  0% { background:transparent; box-shadow:none; }
  20% { background:rgba(255,214,64,0.30); box-shadow:0 0 0 2px rgba(255,193,7,0.30); }
  50% { background:rgba(255,214,64,0.16); box-shadow:0 0 0 2px rgba(255,193,7,0.16); }
  80% { background:rgba(255,214,64,0.30); box-shadow:0 0 0 2px rgba(255,193,7,0.30); }
  100% { background:transparent; box-shadow:none; }
}
.track-flash, .track-flash > * { animation:trackFlash 1.5s ease-in-out 2; border-radius:8px; }

/* 复用提醒：订单信息卡柔和淡金呼吸 */
@keyframes softFlash {
  0%,100% { background:#fff; box-shadow:none; }
  25%,70% { background:#fffbe6; box-shadow:0 0 0 3px rgba(255,193,7,0.28); }
}
.soft-flash { animation:softFlash 1.6s ease-in-out 2; border-radius:12px; }

/* 打印预览 */
.print-preview { display:none; }
#previewContent td, #previewContent th { border:1px solid #000; }
/* 财务记账预览表格 */
.fin-preview-tbl { width:100%; border-collapse:collapse; font-size:12px; }
.fin-preview-tbl th, .fin-preview-tbl td { border:1px solid #ccc; padding:5px 8px; text-align:left; vertical-align:top; }
.mobile-bottom-nav, .mobile-more-overlay { display:none; }
.mobile-bottom-nav { position:fixed; left:0; right:0; bottom:0; z-index:12010; grid-template-columns:repeat(5,1fr); padding:6px 8px calc(6px + env(safe-area-inset-bottom)); background:#fff; border-top:1px solid var(--line); box-shadow:0 -8px 24px rgba(var(--shadow-rgb),.12); }
.mobile-nav-btn { appearance:none; border:0; background:transparent; color:#64748b; min-width:0; min-height:54px; border-radius:10px; font-family:inherit; font-size:11px; font-weight:600; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; cursor:pointer; }
.mobile-nav-btn .mobile-nav-icon { width:25px; height:23px; border-radius:8px; display:grid; place-items:center; font-size:12px; font-weight:800; background:#f1f5f9; color:#475569; }
.mobile-nav-btn.active { color:var(--primary); background:var(--accent-soft); }
.mobile-nav-btn.active .mobile-nav-icon { color:#fff; background:linear-gradient(135deg,var(--primary),var(--primary-2)); box-shadow:0 3px 8px rgba(var(--shadow-rgb),.2); }
.mobile-nav-badge { position:absolute; margin:-24px 0 0 22px; min-width:17px; height:17px; padding:0 4px; border-radius:9px; background:#dc2626; color:#fff; font-size:10px; line-height:17px; text-align:center; }
.mobile-more-overlay { position:fixed; inset:0; z-index:12000; background:rgba(15,23,42,.45); }
.mobile-more-sheet { position:absolute; left:10px; right:10px; bottom:calc(72px + env(safe-area-inset-bottom)); padding:14px; background:#fff; border-radius:16px; box-shadow:0 18px 50px rgba(15,23,42,.3); }
.mobile-more-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; padding:0 2px; }
.mobile-more-head strong { font-size:16px; color:var(--primary); }
.mobile-more-close { border:0; background:#f1f5f9; color:#475569; width:30px; height:30px; border-radius:9px; font-size:18px; cursor:pointer; }
.mobile-more-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.mobile-more-item { appearance:none; border:1px solid var(--line); background:#fff; color:var(--ink); border-radius:11px; padding:12px; min-height:60px; text-align:left; font-family:inherit; cursor:pointer; }
.mobile-more-item:active, .mobile-more-item.active { border-color:var(--accent); background:var(--accent-soft); }
.mobile-more-item strong { display:block; font-size:14px; margin-bottom:3px; }
.mobile-more-item small { color:#64748b; font-size:11px; }
.mobile-more-user { margin-top:10px; padding:10px 12px; border-radius:10px; background:#f8fafc; color:#64748b; font-size:12px; display:flex; align-items:center; justify-content:space-between; gap:10px; }
.mobile-more-user button { border:1px solid #fecaca; background:#fff; color:#b91c1c; border-radius:8px; padding:6px 10px; font-family:inherit; cursor:pointer; }
@media print {
  .fin-preview-tbl th, .fin-preview-tbl td { border:1px solid #000; }
}
@media (max-width: 768px) {
  .header { padding:12px 16px; }
  .header h1 { font-size:15px; }
  .container { padding:8px; }
  .form-grid { grid-template-columns:1fr; gap:10px; }
  .type-tab { font-size:13px; padding:8px; }
  .desktop-main-tabs { display:none; }
  .sidenav { display:none; }
  /* 顶栏在 390 宽下原本挤成三行（约 98px，占掉一屏的 12%）：
     地址与时钟对手机用户没用，隐掉；其余压紧到一行。 */
  .header { padding:10px 12px; gap:8px; }
  .header-title { font-size:16px; }
  .header-right { gap:8px; }
  .header-right > div[style*="text-align:right"] { display:none; }
  .header-user { gap:6px; }
  .header-user span { max-width:96px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .header-user button { white-space:nowrap; padding:5px 8px; }
  .app-body { flex-direction:column; }
  body.app-ready { padding-bottom:calc(72px + env(safe-area-inset-bottom)); }
  body.app-ready .pwa-install-banner.show{bottom:calc(80px + env(safe-area-inset-bottom))}
  body.app-ready .page-index-fab.available{bottom:calc(82px + env(safe-area-inset-bottom))}
  /* 手机上「目录」按钮被底部导航顶高了 62px，面板要跟着一起抬，否则会压住按钮 */
  body.app-ready .page-index-overlay{--pi-anchor:calc(130px + env(safe-area-inset-bottom))}
  body.app-ready .mobile-bottom-nav { display:grid; }
  .mobile-more-overlay.show { display:block; }
  .card { padding:14px; margin-bottom:10px; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .card-title { font-size:14px; margin-bottom:10px; }
  .btn { width:auto; min-height:40px; padding:9px 14px; text-align:center; }
  .btn-row { flex-direction:row; gap:8px; }
  .btn-row > .btn, .btn-row > .action-menu { flex:1 1 130px; }
  .form-group > .btn { width:100%; }
  .ui-toolbar { gap:8px; }
  .ui-toolbar .toolbar-search { flex:1 1 100%; width:100% !important; max-width:none !important; margin-left:0 !important; }
  .ui-action-group { gap:6px; }
  .ui-action-group .btn { flex:1 1 120px; }
  .table-actions { flex-wrap:nowrap; }
  .table-actions .btn { width:auto; min-height:30px; padding:4px 8px; }
  /* 车间里是戴着手套点的，按钮不能为了省高度缩到 28px：手指够不准，删除又挨着标记问题。
     36px 是这套界面里还能一行放下四个按钮的下限（375 宽实测 244px，320 宽 244px 也塞得下）。 */
  .history-actions { order:4; width:100%; margin-top:2px; gap:6px; }
  .history-actions .btn { width:auto; min-height:36px; padding:6px 12px !important; font-size:13px !important; }
  .dialog-actions .btn { flex:1 1 120px; }
  .order-action-bar { position:sticky; bottom:74px; display:grid; grid-template-columns:1fr 1fr; gap:7px; }
  .order-action-bar .btn, .order-action-bar .action-menu { width:100%; }
  .action-menu > summary { width:100%; text-align:center; }
  .action-menu-panel { left:0; right:0; width:auto; }
  .track-info-grid { grid-template-columns:1fr; }
  .track-info-grid > [style*="grid-column"] { grid-column:1 !important; }
  .track-section { grid-column:1; }
  /* 工单管理卡片同历史工单：白底压白底 + 桌面用的 min-width 占位把一行撑成五行（178px）。
     手机上取消占位、压紧行距，卡片给浅底跟卡面分开。 */
  .track-card { background:var(--hover-bg); border-color:var(--input-border); }
  .track-card:nth-child(even) .track-row { background:transparent; }
  .track-row { padding:9px 10px; gap:3px 8px; }
  .track-row .track-no { order:1; flex:1 1 auto; min-width:0 !important; }
  .track-row .status-pill { order:2; }
  /* 摘要那一格带着 style="flex:1"，内联样式压过样式表的 flex-basis，
     所以这里必须整条 flex 一起写死，否则它会被挤成 40px 宽竖着排下来。 */
  .track-row .track-order-summary { order:3; flex:1 1 100% !important; line-height:1.5; }
  .track-row .track-date, .track-row .track-due, .track-row .track-overdue { order:4; min-width:0 !important; }
  .track-row .track-overdue-gap { display:none; }
  /* 状态下拉原本只有 23px 高，改状态是这一页最常点的动作，先保证点得中 */
  .track-row select { order:5; min-height:36px; padding:6px 8px; font-size:13px; }
  .track-row .btn { order:5; min-height:36px; }
  .track-detail-toggle { order:6; margin-left:auto; }
  .track-detail { padding:10px; }
  .track-inline-form input { flex:1 1 120px; min-width:100px; width:auto !important; }
  .track-inline-form .btn { flex:1 1 120px; }
  .track-part-row { grid-template-columns:1fr; gap:4px; }
  .track-part-input input { width:100%; }
  .dashboard-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns:1fr; }
  .dashboard-hero { padding:16px; }
  /* 手机端历史工单：原来白卡片压在白卡面上，只有一条浅边框分界，一眼看过去是一整块；
     而且一张单要占掉 152px（单号 / 摘要 / 相对天数 / 完整时间 / 按钮 各占一行），
     390 宽的屏幕一屏只剩两三张。这里改成浅底 + 三行：单号与时间同排、摘要、操作。 */
  .history-item { flex-wrap:wrap; gap:2px 6px; padding:9px 10px; background:var(--hover-bg); border-color:var(--input-border); }
  .history-item:nth-child(even) { background:var(--hover-bg); }
  .history-item .order-id { order:1; flex:1 1 auto; min-width:0; }
  /* 「今天 / 昨天」与右边的完整时间是同一件事，手机上只留完整时间 */
  .history-item .order-day { display:none; }
  .history-item .order-time { order:2; flex:none; margin-left:auto; margin-right:0; }
  .history-item .order-info { order:3; flex-basis:100%; margin:2px 0 5px; line-height:1.5; }
  .list-color-legend { width:100%; justify-content:flex-end; }
  /* 手机端宽表格：容器内横向滚动，不挤压列 */
  #monthlyStats, #dataTable, #stockList, #stockLogs, #fgList, #fgLogs { overflow-x:auto; -webkit-overflow-scrolling:touch; }
  #monthlyStats table, #dataTable table, #stockList table, #stockLogs table, #fgList table, #fgLogs table { min-width:620px; }
  /* 手机端：表格最右边的「操作」列吸在右侧，不必横向滑到最后才能点到盘点/编辑/删除。
     （390 宽下表格 620px、可视只有 348px，操作按钮原本落在 x=505~633，等于藏在屏幕外） */
  #monthlyStats table tr > *:last-child,
  #dataTable table tr > *:last-child,
  #stockList table tr > *:last-child,
  #stockLogs table tr > *:last-child,
  #fgList table tr > *:last-child,
  #fgLogs table tr > *:last-child,
  #finExpenseList table tr > *:last-child,
  #finIncomeList table tr > *:last-child {
    position:sticky; right:0; z-index:1; background-color:#fff;
    box-shadow:-8px 0 10px -8px rgba(15,23,42,.30);
  }
  /* 吸附列自带白底，会盖掉斑马纹/表头底色/编辑行底色，这里逐一补回 */
  #monthlyStats table th:last-child,
  #dataTable table th:last-child,
  #stockList table th:last-child,
  #stockLogs table th:last-child,
  #fgList table th:last-child,
  #fgLogs table th:last-child,
  #finExpenseList table th:last-child,
  #finIncomeList table th:last-child { background-color:var(--hover-bg); }
  #monthlyStats table tr:nth-child(even) > *:last-child,
  #dataTable table tr:nth-child(even) > *:last-child,
  #stockList table tr:nth-child(even) > *:last-child,
  #stockLogs table tr:nth-child(even) > *:last-child,
  #fgList table tr:nth-child(even) > *:last-child,
  #fgLogs table tr:nth-child(even) > *:last-child,
  #finExpenseList table tr:nth-child(even) > *:last-child,
  #finIncomeList table tr:nth-child(even) > *:last-child {
    background-image:linear-gradient(rgba(var(--accent-rgb),0.05),rgba(var(--accent-rgb),0.05));
  }
  #stockList table tr[style*="fdf6ec"] > *:last-child,
  #fgList table tr[style*="fdf6ec"] > *:last-child { background-color:#fdf6ec; background-image:none; }
  /* 吸附列会盖住 border-collapse 画的左边框，补一条 */
  #monthlyStats table tr > *:last-child::before,
  #dataTable table tr > *:last-child::before,
  #stockList table tr > *:last-child::before,
  #stockLogs table tr > *:last-child::before,
  #fgList table tr > *:last-child::before,
  #fgLogs table tr > *:last-child::before,
  #finExpenseList table tr > *:last-child::before,
  #finIncomeList table tr > *:last-child::before {
    content:''; position:absolute; left:0; top:0; bottom:0; width:1px; background:var(--line);
  }
}
@media (max-width: 480px) {
  .header { flex-wrap:wrap; row-gap:6px; padding:10px 12px; }
  .header h1 { font-size:14px; letter-spacing:0; }
  #serverIP { display:none; }
  .theme-switch { padding:4px 8px; }
  .type-tab { font-size:12px; padding:8px 4px; }
  .card { padding:12px; }
  .list-color-legend { justify-content:flex-start; gap:8px; }
  .ui-action-group.mobile-stack { width:100%; }
  .ui-action-group.mobile-stack .btn { flex-basis:100%; }
  .dialog-actions { display:grid; grid-template-columns:1fr 1fr; }
  .dialog-actions .btn { width:100%; }
}
@media print {
  @page { size: A4; margin: 12mm; }
  body > *:not(.print-preview) { display:none !important; }
  /* display 带 !important 是为了盖掉屏幕上的 display:none；改成 flex 竖排，
     下面的「撑满一页」才有一个 flex 父级可用（写成两条会被这条 !important 压回 block）。 */
  .print-preview { display:flex !important; flex-direction:column; width:100%; font-size:13px; }
  .print-preview td, .print-preview th { border:1px solid #000; padding:4px 6px; }
  /* 一页装不下就挤到第二页：A4 12mm 页边距下可用高度 1032px，而这张单实测 971px，
     只剩 61px 余量 —— 包装要求多一行、产品名换行、或产品图多一张就翻页。
     下面几条专挤打印时的空白（屏幕预览与 PDF 不受影响），腾出约 240px 余量。
     单元格 padding 必须带 !important：行内 style 写死了 6px 8px，会压过样式表。 */
  .print-sheet { padding:0 !important; max-width:none !important; }   /* @page 已给了 12mm 页边距，不必再套一层 20px */
  .print-preview td, .print-preview th { padding:3px 6px !important; line-height:1.35; }
  .print-preview hr { margin:10px 0 !important; }
  .print-preview h2 { margin:0 0 6px !important; }
  /* 产品图是唯一会无限长高的块：多传几张就把跟踪表整个顶到第二页 */
  .print-preview img { max-height:110px !important; max-width:150px !important; margin:2px !important; }
  /* 表格宁可整张挪，也不要从中间劈开 */
  .print-preview table { page-break-inside:avoid; break-inside:avoid; }
  /* 省下来的空间不要白空着：让生产记录表撑满整页剩余高度，行变高、车间好写字。
     内容多的单它就缩回自然高度，仍然一页；内容少的单也不会在下半页留一大块空白。
     原理：整张纸做成 flex 竖排，最后那张表 flex:1 吃掉剩余，表格高度分摊到各行。 */
  /* html/body 要 height:100%（纸张高度是定值，百分比才有依据）；.print-preview 用
     min-height:100% —— 内容短时撑满一页，内容真的超长时还能继续长高、正常翻到第二页。
     写死 height 的话超出部分会被裁掉，纸上少印内容比多印一页严重得多。
     再往里不能继续写百分比：父级高度是 auto 时百分比解析不出来，链子会断（实测行高
     退回 25px、填充失效），所以里面一律用 flex 撑。 */
  html, body { height:100%; }
  .print-preview { min-height:100%; }
  .print-sheet { flex:1 1 auto; display:flex; flex-direction:column; box-sizing:border-box; }
  .print-sheet > table:last-of-type { flex:1 1 auto; }
  .mobile-bottom-nav, .mobile-more-overlay { display:none !important; }
}

  .warehouse-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:8px 0 12px}
  /* container-type 是给 .warehouse-overview 用的：缩略图要按「滚动口有多宽」定宽，
     而 100vw / 100% 都量不到这个数（见下面 .warehouse-overview 的注释）。
     浮动列尺挂在 document.body 上，不在本容器内，不受 contain:layout 影响。 */
  .warehouse-board{display:flex;flex-direction:column;gap:12px;overflow-x:auto;padding:4px 2px 12px;cursor:grab;scroll-behavior:smooth;container-type:inline-size}
  .warehouse-lane-grip{display:inline-block;margin-right:6px;padding:0 3px;color:#94a3b8;font-size:13px;cursor:grab;user-select:none;vertical-align:middle}
  .warehouse-lane-grip:hover{color:var(--accent)}
  .warehouse-lane-grip:active{cursor:grabbing}
  .warehouse-lane.lane-dragging{opacity:.42}
  .warehouse-add-cell.drag-over{border-color:var(--accent);background:var(--accent-soft)}
  /* 空槽代表真实空间位置：外框尺寸必须和普通库位一致，不能因为没有实体库位就缩小。 */
  .warehouse-add-cell.warehouse-gap-cell{flex:0 0 340px;align-self:flex-start;width:340px;height:250px;min-height:250px;box-sizing:border-box;padding:10px;background:repeating-linear-gradient(135deg,#fbfdff,#fbfdff 12px,#f3f6fa 12px,#f3f6fa 24px)}
  .warehouse-gap-cell .warehouse-add-btn{min-height:76px;flex:1}
  .warehouse-gap-delete{align-self:flex-end;padding:3px 8px;border:1px solid #fecaca;border-radius:999px;background:#fff;color:#b91c1c;font:600 11px/1.4 system-ui,sans-serif;cursor:pointer}
  .warehouse-gap-delete:hover,.warehouse-gap-delete:focus-visible{border-color:#dc2626;background:#fef2f2;outline:none}
  .warehouse-add-cell--droponly{align-items:center}
  .warehouse-add-hint{color:#94a3b8;font-size:11px;text-align:center;line-height:1.5}
  /* 库位上直接加料：搜索结果列表 */
  .warehouse-add-results{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;min-height:34px}
  .warehouse-add-hit{max-width:100%;padding:7px 11px;border:1px solid #dbe3ec;border-radius:999px;background:#fff;font-family:inherit;font-size:13px;color:#334155;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .warehouse-add-hit:hover{border-color:var(--accent);color:var(--accent)}
  .warehouse-add-hit.picked{border-color:var(--accent);background:var(--accent-soft);color:var(--accent);font-weight:700}
  .warehouse-add-tip{font-size:12px;color:#94a3b8;padding:7px 2px}
.fg-name-jump{color:inherit;text-decoration:none;border-bottom:1px dashed #c7d2fe;cursor:pointer}
  .fg-name-jump:hover{color:var(--primary);border-bottom-color:var(--primary)}
  .server-updating-banner{position:fixed;left:50%;top:0;transform:translateX(-50%);z-index:30000;
    background:#7c2d12;color:#fff;font-size:13px;line-height:1.5;padding:9px 18px;border-radius:0 0 10px 10px;
    box-shadow:0 6px 20px rgba(0,0,0,.25);max-width:min(92vw,560px);text-align:center}
  .server-updating-banner.is-ok{background:#166534}
    .warehouse-add-draw{font-size:12px;color:#9a6a00;background:#fff7e6;border:1px solid #ffe0a3;border-radius:6px;padding:7px 10px;margin-top:8px;line-height:1.5}
  .warehouse-item-go{display:none}
  .warehouse-lane-tip{display:block;margin-top:3px;font-weight:600;color:var(--accent);font-size:11px}
  /* 父级必须覆盖整排横向宽度，否则 sticky 排号滑到父级右边界后仍会消失。 */
  .warehouse-row-group{display:flex;flex-direction:column;gap:5px;width:max-content;min-width:100%}
  .warehouse-row-group.unassigned-row{padding-bottom:10px;border-bottom:2px dashed #dbe3ee;margin-bottom:2px}
  .warehouse-row{display:flex;gap:12px;align-items:flex-start;width:max-content;min-width:100%}
  .warehouse-row-head{position:sticky;left:0;z-index:4;width:max-content}
  .warehouse-column-ruler{display:flex;gap:12px;width:max-content;min-width:100%;padding:4px 0 7px;border-bottom:1px dashed #bfdbfe;background:#fff;box-sizing:border-box}
  .warehouse-column-ruler-cell{display:flex;flex:0 0 340px;width:340px;justify-content:center;box-sizing:border-box;white-space:nowrap}
  .warehouse-column-floating{display:none;position:fixed;top:0;overflow:hidden;z-index:30;pointer-events:none;background:#fff;border-bottom:1px solid #bfdbfe;box-shadow:0 5px 12px rgba(15,23,42,.12)}
  .warehouse-column-floating.is-visible{display:block}
  .warehouse-column-floating .warehouse-column-ruler{min-width:0;padding-top:6px;border-bottom:0}
  /* width:max-content：车间块在横向滚动的板子里，若只占可视宽度，
     右边的库位会露在虚线框外（截图里第三个库位卡片戳出圆角边框）。 */
  .warehouse-workshop-group{display:flex;flex-direction:column;gap:7px;margin-top:8px;padding:10px;border:1px solid #cbd5e1;border-radius:12px;background:#f8fafc;width:max-content;min-width:100%;box-sizing:border-box}
  .warehouse-workshop-head{position:sticky;left:0;z-index:4;display:flex;align-items:center;gap:9px;width:max-content;max-width:calc(100vw - 72px);padding:4px 9px;border-radius:8px;background:#e2e8f0;color:#334155}
  .warehouse-workshop-head strong{font-size:13px}
  .warehouse-workshop-head span{font-size:11px;color:#64748b}
  /* 主仓分区本来就占满整块板，不再多套一层框；车间是并列的小块，保留框才分得开 */
  .warehouse-workshop-group.is-main-zone{margin-top:0;padding:0;border:0;background:transparent}
  /* 排号钉在左边，横向平移时不跟着跑掉，滑到第 8 位也知道自己在哪一排 */
  /* 每个实体库位对应固定空间位置：空库位也保持与有货库位相同尺寸。 */
  .warehouse-lane.is-empty{min-height:250px}
  .warehouse-lane.is-empty .warehouse-lane-cards{min-height:178px}
  .warehouse-lane.is-empty .warehouse-empty{min-height:178px;padding:18px 4px;font-size:12px}
  .warehouse-row-label,.warehouse-column-label{display:inline-block;padding:3px 11px;border-radius:999px;background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#fff;font-size:12px;font-weight:700;letter-spacing:.5px;box-shadow:0 2px 6px rgba(var(--shadow-rgb),.18)}
  .warehouse-add-cell{flex:0 0 132px;align-self:stretch;min-height:96px;display:flex;flex-direction:column;justify-content:center;gap:6px;border:2px dashed #cbd5e1;border-radius:10px;background:#fcfdff;padding:8px}
  .warehouse-add-cell.open{flex-basis:190px;border-style:solid;border-color:var(--accent);background:#fff}
  .warehouse-add-btn{width:100%;height:100%;min-height:80px;border:0;background:transparent;color:#64748b;font-family:inherit;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;border-radius:8px}
  .warehouse-add-btn:hover{background:var(--accent-soft);color:var(--accent)}
  .warehouse-add-plus{font-size:22px;line-height:1;font-weight:700}
  .warehouse-add-btn small{font-size:11px}
  .warehouse-add-input{width:100%;box-sizing:border-box;padding:8px 9px;border:1px solid var(--input-border);border-radius:7px;font-family:inherit;font-size:13px}
  .warehouse-add-actions{display:flex;gap:6px}
  .warehouse-add-actions .btn{flex:1;min-height:0;padding:6px 8px;font-size:12px}
  .warehouse-board.panning{cursor:grabbing;scroll-snap-type:none;scroll-behavior:auto;user-select:none}
  .warehouse-nav{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:0 0 10px}
  .warehouse-nav-label{font-size:12px;color:#94a3b8;margin-right:2px}
  .warehouse-nav-chip{display:inline-flex;align-items:center;gap:4px;max-width:180px;padding:4px 10px;border:1px solid #dbe3ec;border-radius:999px;background:#fff;font-size:12px;color:#334155;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:.14s}
  .warehouse-nav-chip:hover{border-color:#1a56db;color:#1a56db;background:#f5f8ff}
  .warehouse-nav-chip.unassigned{border-color:#e6b566;background:#fffaf0}
  .warehouse-nav-chip.unassigned:hover{border-color:#d97706;color:#b45309}
  .warehouse-nav-count{font-size:11px;color:#94a3b8}
  .warehouse-nav-chip:hover .warehouse-nav-count{color:inherit}
  .warehouse-jump-input{padding:7px 10px;border:1px solid #d9d9d9;border-radius:6px;min-width:190px}
  /* 宽度必须按 .warehouse-board 这个横向滚动口来算，不能按视口：
     滚动口只有 866px（左侧栏和卡片内边距吃掉了，1280/1440/1920 三个视口量下来都一样），
     而 calc(100vw - 72px) 在 1440 视口下算出 1368，min() 每次都挑中 920px——比滚动口宽 52px。
     它又是 sticky 钉在 left:0，横向拖也拖不出来，于是第 19 列被永久切掉 37px（2026-08-31 线上报障）。
     max-width:100% 兜不住：在这个溢出的 flex 容器里百分比按内容宽 6820px 解析，等于没写。
     所以用容器查询单位 100cqi = 滚动口自身宽度。上面一行是老浏览器的回退（维持旧表现，
     不至于因为 100cqi 不认识而整条 width 失效、缩略图被拉成 6820px）。 */
  .warehouse-overview{position:sticky;left:0;width:min(920px,calc(100vw - 72px));width:min(920px,100cqi);box-sizing:border-box;padding:12px 14px;border:1px solid #dbe3ec;border-radius:12px;background:#fff;box-shadow:0 3px 12px rgba(15,23,42,.07);z-index:3}
  .warehouse-overview-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:9px;color:#1f2937}
  .warehouse-overview-head strong{font-size:14px}
  .warehouse-overview-head span{font-size:11px;color:#64748b}
  .warehouse-overview-grid{display:grid;grid-template-columns:28px repeat(var(--warehouse-overview-cols),minmax(18px,1fr));gap:3px;align-items:stretch}
  /* 车间只有两三列时，1fr 会把格子拉成巨大的色块，列之间还会被拉开（二楼 20+ 列看不出来）。
     少列的分区改用固定列宽并整体靠左，比例和二楼一致。 */
  .warehouse-overview.is-compact .warehouse-overview-grid{
    grid-template-columns:28px repeat(var(--warehouse-overview-cols),52px);
    justify-content:start}
  .warehouse-overview-axis{min-width:0;display:grid;place-items:center;color:#64748b;font-size:9px;line-height:1;font-variant-numeric:tabular-nums}
  .warehouse-overview-row-axis{font-size:10px;font-weight:700;color:#334155}
  .warehouse-overview-cell{min-width:0;aspect-ratio:1.35/1;border:1px solid #cbd5e1;border-radius:3px;padding:0;display:grid;place-items:center;position:relative;background:#fff;color:#fff;font:700 9px/1 Arial,sans-serif;cursor:pointer;transition:.12s;touch-action:manipulation}
  .warehouse-overview-cell:hover{transform:scale(1.12);position:relative;z-index:2;box-shadow:0 2px 7px rgba(15,23,42,.24)}
  .warehouse-overview-cell.is-occupied,.warehouse-overview-legend i.is-occupied{background:#2563eb;border-color:#1d4ed8}
  .warehouse-overview-cell.has-backlog,.warehouse-overview-legend i.has-backlog{background:#f97316;border-color:#c2410c}
  .warehouse-overview-cell.has-alert{background:#dc2626;border-color:#b91c1c}
  .warehouse-overview-cell.is-location-empty,.warehouse-overview-legend i.is-location-empty{background:#f8fafc;border-color:#94a3b8}
  .warehouse-overview-cell.is-gap,.warehouse-overview-legend i.is-gap{border-style:dashed;background:repeating-linear-gradient(135deg,#f8fafc,#f8fafc 4px,#e9eef5 4px,#e9eef5 8px);cursor:default}
  .warehouse-overview-detail{display:none;position:absolute;left:50%;top:calc(100% + 7px);transform:translateX(-50%);z-index:20;width:240px;max-width:calc(100vw - 48px);box-sizing:border-box;padding:9px 11px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:#334155;text-align:left;font:400 12px/1.45 system-ui,sans-serif;box-shadow:0 7px 22px rgba(15,23,42,.22);pointer-events:none}
  .warehouse-overview-detail::after{content:"";position:absolute;left:50%;bottom:100%;margin-left:-5px;border:5px solid transparent;border-bottom-color:#fff}
  .warehouse-overview-detail b{display:block;margin-bottom:5px;color:#1e3a8a;font-size:13px}
  .warehouse-overview-detail>span{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:14px}
  .warehouse-overview-product-name{min-width:0;overflow-wrap:anywhere}
  .warehouse-overview-detail small{color:#64748b;font-size:11px;white-space:nowrap}
  .warehouse-overview-detail em{display:block;margin-top:5px;color:#2563eb;font-size:10px;font-style:normal}
  .warehouse-overview-detail .warehouse-overview-backlog-text{display:inline-block;margin:0 0 0 5px;padding:1px 4px;border-radius:999px;background:#ffedd5;color:#c2410c;font-size:9px;font-weight:700;vertical-align:1px}
  .warehouse-overview-backlog{position:absolute;right:-4px;top:-5px;min-width:15px;padding:2px 3px;border:1px solid #fff;border-radius:999px;background:#9a3412;color:#fff;font:700 7px/1 system-ui,sans-serif;box-shadow:0 1px 3px rgba(15,23,42,.3)}
  .warehouse-overview-cell.detail-align-left .warehouse-overview-detail{left:0;transform:none}
  .warehouse-overview-cell.detail-align-left .warehouse-overview-detail::after{left:12px;margin-left:0}
  .warehouse-overview-cell.detail-align-right .warehouse-overview-detail{left:auto;right:0;transform:none}
  .warehouse-overview-cell.detail-align-right .warehouse-overview-detail::after{left:auto;right:12px;margin-left:0}
  .warehouse-overview-cell:hover .warehouse-overview-detail,.warehouse-overview-cell:focus-visible .warehouse-overview-detail,.warehouse-overview-cell.is-open .warehouse-overview-detail{display:block}
  .warehouse-overview-touch-hint{display:none}
  .warehouse-overview-legend{display:flex;flex-wrap:wrap;gap:12px;margin-top:9px;color:#64748b;font-size:11px}
  .warehouse-overview-legend span{display:inline-flex;align-items:center;gap:5px}
  .warehouse-overview-legend i{display:inline-block;width:13px;height:10px;border:1px solid #94a3b8;border-radius:2px}

  /* 厂区总览：同一张图同时承载原料、成品和三个混合车间，但库存操作仍回到各自模块。 */
  .factory-map-card{overflow:visible}
  .factory-map-title{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:12px}
  .factory-map-title>div:first-child{display:flex;flex-direction:column;gap:3px}
  .factory-map-title strong{font-size:18px;color:#1f2937}
  .factory-map-title>div:first-child span{font-size:12px;color:#64748b}
  .factory-map-legend{display:flex;flex-wrap:wrap;gap:10px;color:#64748b;font-size:11px}
  .factory-map-legend span{display:inline-flex;align-items:center;gap:5px}
  .factory-map-legend i{display:inline-block;width:15px;height:11px;border:1px solid #cbd5e1;border-radius:3px}
  .factory-map-legend .is-stock,.factory-location-cell.is-stock{background:#f59e0b;border-color:#d97706}
  .factory-map-legend .is-finished,.factory-location-cell.is-finished{background:#2563eb;border-color:#1d4ed8}
  .factory-map-legend .has-backlog,.factory-location-cell.has-backlog{background:#f97316;border-color:#c2410c}
  .factory-map-legend .is-match{background:#fef08a;border-color:#ca8a04;box-shadow:0 0 0 2px rgba(250,204,21,.25)}
  .factory-map-search{display:flex;gap:8px;margin-bottom:12px}
  .factory-map-search input{flex:1;min-width:0;padding:9px 12px;border:1px solid #cbd5e1;border-radius:7px;font-size:13px;outline:none}
  .factory-map-search input:focus{border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.12)}
  .factory-building{display:flex;flex-direction:column;gap:18px;padding:14px;border:1px solid #d9e2ec;border-radius:12px;background:#f8fafc;overflow:visible}
  .factory-floor{display:grid;grid-template-columns:64px minmax(0,1fr);gap:10px;min-width:0}
  .factory-floor-label{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;border-right:3px solid #334155;color:#334155}
  .factory-floor-label b{font-size:20px}
  .factory-floor-label span{font-size:10px;line-height:1.35;text-align:center;color:#64748b}
  .factory-floor-content{position:relative;min-width:0}
  .factory-floor-two .factory-floor-content{padding-right:52px}
  .factory-floor-one-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:42px 56px;padding:14px 6px 6px}
  .factory-zone{position:relative;z-index:1;min-width:0;min-height:105px;padding:9px;border:2px solid #94a3b8;border-radius:8px;background:#fff;box-sizing:border-box;overflow:visible}
  .factory-zone:hover,.factory-zone:focus-within{z-index:25}
  .factory-zone-floor2-finished{min-height:190px;border-color:#60a5fa;background:#eff6ff}
  .factory-zone-floor1-raw{border-color:#fbbf24;background:#fffbeb}
  .factory-zone-floor1-workshop-nw,.factory-zone-floor1-workshop-sw,.factory-zone-floor1-workshop-se{border-color:#a8b3c2;background:#fff}
  .factory-zone-head{display:flex;justify-content:space-between;gap:10px;align-items:baseline;margin-bottom:7px}
  .factory-zone-head strong{font-size:13px;color:#1f2937}
  .factory-zone-head span{font-size:10px;color:#64748b;white-space:nowrap}
  .factory-zone-head-actions{display:flex;align-items:center;justify-content:flex-end;gap:7px;min-width:0}
  .factory-zone-add{padding:2px 7px;border:1px solid #93c5fd;border-radius:999px;background:#eff6ff;color:#1d4ed8;font:700 10px/1.5 system-ui,sans-serif;white-space:nowrap;cursor:pointer}
  .factory-zone-add:hover,.factory-zone-add:focus-visible{border-color:#2563eb;background:#dbeafe;outline:none}
  .factory-zone-empty{display:grid;place-items:center;min-height:58px;padding:8px;border:1px dashed #cbd5e1;border-radius:6px;color:#94a3b8;font-size:11px;line-height:1.5;text-align:center}
  .factory-zone-grid{display:grid;grid-template-columns:22px repeat(var(--factory-grid-cols),minmax(10px,1fr));gap:1px 2px;align-items:center}
  .factory-grid-axis{display:grid;place-items:center;min-width:0;color:#64748b;font-size:7px;line-height:1}
  .factory-grid-row-axis{font-size:8px;font-weight:700;color:#334155}
  .factory-location-gap{display:block;aspect-ratio:1.35/1;border:1px dashed #dbe3ec;border-radius:2px;background:repeating-linear-gradient(135deg,#f8fafc,#f8fafc 3px,#edf2f7 3px,#edf2f7 6px)}
  .factory-location-cell{position:relative;min-width:0;min-height:18px;aspect-ratio:1.35/1;padding:0 2px;border:1px solid;border-radius:3px;color:#fff;font:700 8px/1 system-ui,sans-serif;cursor:pointer;transition:.12s;z-index:1;touch-action:manipulation}
  .factory-zone-grid .factory-location-cell,.factory-zone-grid .factory-location-gap{height:9px;min-height:9px;aspect-ratio:auto;border-radius:2px;font-size:6px}
  .factory-location-cell.is-empty{opacity:.42}
  .factory-location-cell:hover,.factory-location-cell:focus-visible{transform:scale(1.1);z-index:30;box-shadow:0 3px 9px rgba(15,23,42,.25)}
  .factory-location-cell.is-match{background:#facc15!important;border-color:#a16207!important;color:#713f12;opacity:1;box-shadow:0 0 0 2px rgba(250,204,21,.35);z-index:4}
  .factory-location-cell.is-dimmed{opacity:.12}
  .factory-location-code{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .factory-location-backlog{position:absolute;right:-4px;top:-5px;min-width:13px;padding:2px 3px;border:1px solid #fff;border-radius:999px;background:#9a3412;color:#fff;font:700 6px/1 system-ui,sans-serif;box-shadow:0 1px 3px rgba(15,23,42,.3);z-index:3}
  .factory-mixed-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(42px,1fr));gap:4px;align-content:start}
  .factory-mixed-grid .factory-location-cell{min-height:27px;aspect-ratio:auto;font-size:9px}
  .factory-location-detail{display:none;position:absolute;left:50%;top:calc(100% + 6px);transform:translateX(-50%);z-index:50;width:250px;max-width:calc(100vw - 48px);box-sizing:border-box;padding:9px 11px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:#334155;text-align:left;font:400 12px/1.45 system-ui,sans-serif;box-shadow:0 8px 24px rgba(15,23,42,.25);pointer-events:none}
  .factory-location-detail::after{content:"";position:absolute;left:50%;bottom:100%;margin-left:-5px;border:5px solid transparent;border-bottom-color:#fff}
  .factory-location-cell.detail-above .factory-location-detail{top:auto;bottom:calc(100% + 6px)}
  .factory-location-cell.detail-above .factory-location-detail::after{top:100%;bottom:auto;border-top-color:#fff;border-bottom-color:transparent}
  .factory-location-detail b{display:block;margin-bottom:5px;color:#1e3a8a;font-size:13px}
  .factory-location-detail>span{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px}
  .factory-location-detail>span>span{min-width:0;overflow-wrap:anywhere}
  .factory-location-detail small{color:#64748b;white-space:nowrap}
  .factory-location-detail em{display:block;margin-top:5px;color:#2563eb;font-size:10px;font-style:normal}
  .factory-location-detail .factory-backlog-text{display:inline-block;margin:0 0 0 5px;padding:1px 4px;border-radius:999px;background:#ffedd5;color:#c2410c;font-size:9px;font-weight:700;vertical-align:1px}
  .factory-location-cell:hover .factory-location-detail,.factory-location-cell:focus-visible .factory-location-detail,.factory-location-cell.is-open .factory-location-detail{display:block}
  .factory-landmark{position:absolute;z-index:5;padding:4px 7px;border:1px solid #94a3b8;border-radius:5px;background:#fff;color:#475569;font-size:10px;font-weight:700;text-align:center;pointer-events:none}
  .factory-stairs{right:0;top:22px;writing-mode:vertical-rl}
  .factory-gate{left:50%;top:-2px;transform:translateX(-50%);background:#dcfce7;border-color:#86efac;color:#166534}
  .factory-passage{left:50%;top:50%;transform:translate(-50%,-50%);width:42px;background:#f1f5f9;border-style:dashed;line-height:1.4}
  .factory-search-note,.factory-search-empty{margin-top:10px;padding:9px 11px;border-radius:7px;background:#f8fafc;color:#64748b;font-size:12px}
  .factory-search-empty{background:#fff7ed;color:#9a3412}
  .factory-search-results{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:8px;margin-top:10px}
  .factory-search-group{padding:9px;border:1px solid #dbe3ec;border-radius:8px;background:#fff}
  .factory-search-group-head{display:flex;justify-content:space-between;gap:10px;margin-bottom:5px}
  .factory-search-group-head strong{font-size:13px;color:#1f2937}
  .factory-search-group-head span{font-size:10px;color:#64748b;text-align:right}
  .factory-search-group button{width:100%;display:flex;justify-content:space-between;gap:8px;margin-top:3px;padding:6px 8px;border:0;border-radius:5px;background:#f8fafc;color:#334155;font-size:11px;text-align:left;cursor:pointer}
  .factory-search-group button:hover{background:#eff6ff;color:#1d4ed8}
  .factory-search-group button b{white-space:nowrap}
  .factory-search-backlog{display:inline-block;margin-left:6px;padding:1px 5px;border-radius:999px;background:#ffedd5;color:#c2410c;font-size:9px;font-style:normal;font-weight:700}
  .factory-map-config{margin-top:10px;border-top:1px solid #e2e8f0;padding-top:8px}
  .factory-map-config summary{width:max-content;cursor:pointer;color:#2563eb;font-size:12px;font-weight:700}
  .factory-map-config-row{display:flex;flex-wrap:wrap;gap:7px;margin-top:8px}
  .factory-map-config-row select{min-width:150px;padding:7px 9px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;font-size:12px}
  .factory-map-config p{margin:6px 0 0;color:#64748b;font-size:10px}
  @media(max-width:600px){.warehouse-overview{width:calc(100vw - 32px);width:min(920px,100cqi);padding:10px}.warehouse-overview-grid{grid-template-columns:20px repeat(var(--warehouse-overview-cols),minmax(13px,1fr));gap:2px}.warehouse-overview.is-compact .warehouse-overview-grid{grid-template-columns:20px repeat(var(--warehouse-overview-cols),minmax(13px,52px))}.warehouse-overview-axis{font-size:7px}.warehouse-overview-cell{border-radius:2px;font-size:7px}.warehouse-overview-head span{display:none}.warehouse-overview-touch-hint{display:inline}}
  @media(max-width:700px){.factory-map-title{display:block}.factory-map-legend{margin-top:8px}.factory-building{overflow-x:auto}.factory-floor{min-width:650px;grid-template-columns:54px minmax(0,1fr)}.factory-floor-one-grid{gap:38px 48px}.factory-map-config-row>*{flex:1 1 100%;min-width:0}.factory-location-detail{width:220px}.factory-search-results{grid-template-columns:1fr}}
  @keyframes warehouseFlash{0%,100%{box-shadow:0 0 0 1px rgba(26,86,219,.08);border-color:#d9e0ea}50%{box-shadow:0 0 0 7px rgba(26,86,219,.28),0 10px 26px rgba(26,86,219,.2);border-color:#1a56db;background:#dbeafe;transform:translateY(-3px)}}
  .warehouse-lane.flash{animation:warehouseFlash .65s ease-in-out 4;position:relative;z-index:8}
  .warehouse-lane{flex:0 0 340px;width:340px;height:250px;min-height:250px;box-sizing:border-box;border:2px dashed #d9e0ea;border-radius:10px;background:#f8fafc;padding:10px;scroll-snap-align:start;transition:.16s;display:flex;flex-direction:column;min-width:0;align-self:flex-start}
  .warehouse-lane.drag-over{border-color:#1a56db;background:#eef4ff;transform:translateY(-2px)}
  .warehouse-lane.unassigned{border-color:#e6b566;background:#fffaf0}
  /* 未分配是「待归位」的暂存区，独占一行；不铺满的话右边会空掉一大片（1440 下空 526px），
     铺满后卡片按宽度自动分列，18 种料一眼看全，也更好把东西拖出去。 */
  .warehouse-lane.unassigned{flex:1 1 auto;width:100%;max-width:none}
  .warehouse-lane.unassigned .warehouse-lane-cards{grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}

  .warehouse-lane-title{display:flex;justify-content:space-between;align-items:center;gap:6px;font-size:13px;font-weight:700;color:#334155;margin-bottom:8px;flex:none}
  .warehouse-lane-capacity{font-size:11px;color:#64748b;font-weight:500;white-space:nowrap}
  /* 行高必须由内容决定：固定/auto 轨道在窄屏滚动容器里可能把按钮挤出卡片，
     下一行随后上移，表现为卡片上下重叠。max-content + stretch 让同一行取最高卡片高度，
     同时保留列间的稳定间距。 */
  .warehouse-lane-cards{flex:1;min-height:178px;max-height:520px;overflow-y:auto;overscroll-behavior:contain;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:max-content;column-gap:8px;row-gap:10px;align-content:start;align-items:stretch}
  .warehouse-item{min-width:0;min-height:0;height:max-content;align-self:stretch;background:#fff;border:1px solid #dce3ec;border-left:4px solid #1a56db;border-radius:7px;padding:9px;margin:0;box-shadow:0 1px 3px rgba(15,23,42,.06);cursor:grab;user-select:none;touch-action:pan-x pan-y;display:flex;flex-direction:column;justify-content:flex-start;overflow:hidden}
  .warehouse-item.negative{border-left-color:#c0392b;background:#fff5f5}
  .warehouse-item.negative-stock{border-left-color:#b91c1c;background:#fff1f2}
  .warehouse-item.pending-deduction{border-left-color:#9333ea;background:#faf5ff}
  .warehouse-item.unassigned-stock{border-left-color:#d97706;background:#fffbeb}
  .warehouse-item.backlog-stock{border-color:#fdba74;border-left-color:#ea580c;background:#fff7ed;box-shadow:0 0 0 2px rgba(249,115,22,.12),0 2px 5px rgba(154,52,18,.12)}
  .warehouse-item.dragging{opacity:.38}
  .warehouse-item:active{cursor:grabbing}
  .warehouse-item-name{font-weight:700;font-size:13px;line-height:1.35;color:#1f2937;white-space:normal;overflow-wrap:anywhere;word-break:break-word}
  .warehouse-item-meta{display:block;margin-top:3px;color:#64748b;font-size:10px;line-height:1.35;overflow-wrap:anywhere}
  .warehouse-item-qty{font-size:12px;color:#e67e22;margin-top:3px}
  .warehouse-backlog-badge{display:inline-flex;align-self:flex-start;margin-top:5px;padding:2px 7px;border-radius:999px;background:#ea580c;color:#fff;font-size:10px;font-weight:800;line-height:1.4}
  /* 两个动作固定在同一操作栏内等宽、等高，避免旧版 flex 的内容宽度把按钮互相顶住。 */
  .warehouse-item-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch;gap:6px;margin-top:7px;min-width:0}
  .warehouse-backlog-toggle{display:inline-flex;align-items:center;justify-content:center;width:100%;min-width:0;min-height:27px;box-sizing:border-box;padding:3px 4px;border:1px solid #fdba74;border-radius:7px;background:#fff;color:#c2410c;font:700 clamp(9px,2.7vw,10px)/1.3 system-ui,sans-serif;cursor:pointer;touch-action:manipulation;white-space:nowrap;overflow:hidden}
  .warehouse-backlog-toggle:hover,.warehouse-backlog-toggle:focus-visible{border-color:#ea580c;background:#ffedd5;outline:none}
  .warehouse-package-edit{display:inline-flex;align-items:center;justify-content:center;width:100%;min-width:0;min-height:27px;box-sizing:border-box;padding:3px 4px;border:1px solid #bfd3f5;border-radius:7px;background:#fff;color:#1a56db;font:700 clamp(9px,2.7vw,10px)/1.3 system-ui,sans-serif;cursor:pointer;touch-action:manipulation;white-space:nowrap;overflow:hidden}
  .warehouse-package-edit:hover,.warehouse-package-edit:focus-visible{border-color:#1a56db;background:#eff4ff;outline:none}
  /* 三个动作时「移库」这条独占一行，两个按钮才不会被挤成竖条 */
  .warehouse-item-actions .warehouse-item-go{grid-column:1/-1}
  .warehouse-empty{grid-column:1/-1;min-height:178px;display:grid;place-items:center;font-size:12px;color:#a0a8b4;text-align:center;padding:18px 4px;border:1px dashed #dce3ec;border-radius:7px}
  .warehouse-drop-marker{grid-column:1/-1;height:5px;margin:2px 1px;border-radius:999px;background:#1a56db;box-shadow:0 0 0 3px rgba(26,86,219,.14);pointer-events:none}
  .warehouse-reconcile-overlay{position:fixed;left:0;right:0;bottom:0;top:var(--vvt,0px);height:100%;height:100dvh;height:var(--vvh,100dvh);z-index:12020;background:rgba(15,23,42,.58);display:flex;align-items:center;justify-content:center;padding:16px;overflow-y:auto;-webkit-overflow-scrolling:touch}
  .warehouse-reconcile-dialog{width:min(580px,100%);max-height:100%;overflow:auto;scroll-padding-block:18px 96px;background:#fff;border-radius:14px;box-shadow:0 24px 70px rgba(15,23,42,.35);overscroll-behavior:contain}
  /* 操作按钮吸在对话框底部：内容长时不必滚到最下面才够得到「确认/取消」。
     负外边距抵掉 body 的左右内边距，让分隔线通栏。 */
  .warehouse-reconcile-dialog .dialog-actions,
  .warehouse-reconcile-dialog .btn-row{position:sticky;bottom:0;z-index:2;margin:14px -18px 0;padding:12px 18px calc(12px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid var(--line);box-shadow:0 -6px 14px rgba(15,23,42,.06)}
  .warehouse-reconcile-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid #e5e7eb}
  .warehouse-reconcile-body{padding:16px 18px}
  .warehouse-reconcile-row{display:grid;grid-template-columns:minmax(110px,1fr) 110px 120px;gap:8px;align-items:center;padding:8px 0;border-bottom:1px solid #f1f5f9;font-size:13px}
  .warehouse-reconcile-row input{width:100%;box-sizing:border-box;padding:7px 8px;border:1px solid #cbd5e1;border-radius:6px;text-align:right}
  .warehouse-batch-hint{margin:6px 0 0;padding:7px 10px;border-radius:7px;background:#eff6ff;border:1px solid #cfe2ff;color:#1d4ed8;font-size:12px;line-height:1.5}
  .warehouse-count-add{display:flex;gap:8px;align-items:center;padding:10px 0 2px}
  .warehouse-count-add input{flex:1;min-width:0;padding:8px 10px;border:1px dashed #94a3b8;border-radius:7px;font-family:inherit;font-size:13px;background:#fff}
  .warehouse-count-add input:focus{border-style:solid;border-color:var(--accent);outline:none}
  .warehouse-count-add .btn{white-space:nowrap;padding:8px 12px;min-height:0;font-size:13px}
  .warehouse-count-book{margin-left:7px;font-size:11px;font-weight:600;color:#64748b;background:#f1f5f9;border-radius:999px;padding:2px 7px;white-space:nowrap}
  .warehouse-count-del{border:0;background:transparent;color:#94a3b8;font-size:17px;line-height:1;padding:0 5px;margin-left:3px;cursor:pointer;vertical-align:middle}
  .warehouse-count-del:hover{color:#b91c1c}
  .warehouse-reconcile-summary{margin-top:12px;padding:10px 12px;border-radius:8px;background:#fff7ed;color:#9a3412;font-size:13px}
  .warehouse-move-route{display:grid;grid-template-columns:1fr 34px 1fr;gap:8px;align-items:stretch;margin-bottom:14px}
  .warehouse-move-place{border:1px solid #e2e8f0;border-radius:10px;background:#f8fafc;padding:10px 12px;min-width:0}
  .warehouse-move-place small{display:block;color:#64748b;font-size:11px;margin-bottom:3px}
  .warehouse-move-place strong{display:block;color:#1e293b;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .warehouse-move-arrow{display:grid;place-items:center;color:var(--accent);font-size:20px;font-weight:700}
  .warehouse-move-filter{width:100%;box-sizing:border-box;margin-bottom:6px;padding:8px 10px;border:1px dashed #94a3b8;border-radius:8px;font-family:inherit;font-size:13px}
  .warehouse-move-filter:focus{border-style:solid;border-color:var(--accent);outline:none}
  .warehouse-move-filter.no-hit{border-color:#f87171;background:#fef2f2}
  .warehouse-move-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}
  .warehouse-move-field label{display:block;color:#475569;font-size:12px;font-weight:600;margin-bottom:5px}
  .warehouse-move-field select,.warehouse-move-field input{width:100%;padding:9px 10px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:#1e293b;-webkit-text-fill-color:#1e293b;caret-color:#1e293b;font-family:inherit;font-size:14px}
  .warehouse-rename-dialog{width:min(440px,100%)}
  .warehouse-rename-input{color:#1e293b!important;-webkit-text-fill-color:#1e293b!important;background:#fff!important;opacity:1!important}
  .warehouse-package-calculator{margin-top:10px;padding:11px;border:1px solid #dbeafe;border-radius:10px;background:#f8fbff}
  .warehouse-package-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:9px}
  .warehouse-package-head strong{display:block;color:#1e3a5f;font-size:13px}
  .warehouse-package-head small{display:block;color:#64748b;font-size:11px;margin-top:2px}
  .warehouse-package-head .btn{min-height:0;padding:7px 10px;font-size:12px;white-space:nowrap}
  .warehouse-package-rows{display:grid;gap:7px}
  .warehouse-package-row{display:grid;grid-template-columns:minmax(75px,1fr) 18px minmax(95px,1fr) minmax(68px,auto) 28px;gap:6px;align-items:end}
  .warehouse-package-row label span{display:block;color:#64748b;font-size:11px;margin-bottom:3px}
  .warehouse-package-row input{width:100%;box-sizing:border-box;padding:8px;border:1px solid #cbd5e1;border-radius:7px;background:#fff;color:#1e293b;-webkit-text-fill-color:#1e293b;font-family:inherit;font-size:14px}
  .warehouse-package-times{align-self:center;text-align:center;color:#64748b;padding-top:16px}
  .warehouse-package-subtotal{align-self:center;color:#1d4ed8;font-size:12px;font-weight:700;white-space:nowrap;padding-top:16px}
  .warehouse-package-remove{align-self:center;border:0;background:transparent;color:#94a3b8;font-size:20px;cursor:pointer;padding:14px 2px 0}
  .warehouse-package-remove:hover{color:#b91c1c}
  .warehouse-package-total{margin-top:8px;padding:7px 9px;border-radius:7px;background:#dbeafe;color:#1e40af;font-size:12px;line-height:1.5}
  .warehouse-package-total.error{background:#fef2f2;color:#b91c1c}
  .warehouse-move-qty{display:flex;gap:6px}
  .warehouse-move-qty input{min-width:0;flex:1}
  .warehouse-move-qty button{border:1px solid var(--input-border);background:#fff;color:var(--primary);border-radius:8px;padding:0 10px;font-family:inherit;white-space:nowrap;cursor:pointer}
  .warehouse-move-preview{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}
  .warehouse-move-preview div{padding:9px 10px;border-radius:8px;background:#f1f5f9;color:#475569;font-size:12px}
  .warehouse-move-preview strong{display:block;color:#1e293b;font-size:15px;margin-top:2px}
  .inventory-health{display:grid;grid-template-columns:repeat(5,minmax(105px,1fr));gap:8px;margin-bottom:12px}
  .inventory-health-item{position:relative;border:1px solid var(--line);border-radius:9px;padding:9px 11px 9px 14px;background:#fff;min-width:0;overflow:hidden}
  .inventory-health-item::before{content:'';position:absolute;left:0;top:0;bottom:0;width:3px;background:#cbd5e1}
  .inventory-health-item strong{display:block;font-size:18px;line-height:1.2;margin-bottom:2px}
  .inventory-health-item span{font-size:12px;color:#64748b;white-space:nowrap}
  .inventory-health-item.danger{color:#b91c1c}.inventory-health-item.danger::before{background:var(--danger)}
  .inventory-health-item.audit{color:#7e22ce}.inventory-health-item.audit::before{background:#a855f7}
  .inventory-health-item.warning{color:#b45309}.inventory-health-item.warning::before{background:var(--warning)}
  .inventory-health-item.low{color:#c2410c}.inventory-health-item.low::before{background:#fb923c}
  .inventory-health-item.ok{color:#15803d}.inventory-health-item.ok::before{background:var(--success)}
  .inventory-status{display:inline-flex;align-items:center;padding:2px 8px;border-radius:999px;font-size:11px;font-weight:600;white-space:nowrap}
  .inventory-status.danger{background:rgba(220,53,69,.10);color:#b91c1c}.inventory-status.audit{background:#f3e8ff;color:#7e22ce}.inventory-status.warning{background:#fef3c7;color:#92400e}.inventory-status.low{background:#ffedd5;color:#c2410c}.inventory-status.ok{background:#dcfce7;color:#15803d}
  .finished-identity-review{margin:12px 0 16px;padding:12px;border:1px solid #dbeafe;border-radius:11px;background:#f8fbff;color:#334155}
  .finished-identity-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:9px}
  .finished-identity-head>div{display:flex;flex-direction:column;gap:3px;min-width:0}
  .finished-identity-head strong{font-size:14px;color:#1e3a8a}
  .finished-identity-head span{font-size:11px;color:#64748b;line-height:1.4}
  .finished-identity-head .btn{flex:0 0 auto;min-height:0;padding:5px 9px;font-size:12px}
  .finished-identity-summary,.finished-identity-note{padding:8px 10px;border-radius:7px;background:#eff6ff;color:#1d4ed8;font-size:12px;line-height:1.5}
  .finished-identity-note.is-ok{background:#ecfdf5;color:#047857}
  .finished-identity-note.is-error{background:#fff7ed;color:#b45309}
  .finished-identity-unassigned{margin:9px 0;border:1px solid #bfdbfe;border-radius:8px;background:#fff;overflow:hidden}
  .finished-identity-unassigned>summary{cursor:pointer;padding:9px 10px;color:#1d4ed8;font-size:12px;font-weight:700;background:#eff6ff}
  .finished-identity-unassigned>p{margin:8px 10px;color:#64748b;font-size:11px}
  .finished-identity-code-list{max-height:420px;overflow:auto;border-top:1px solid #e2e8f0}
  .finished-identity-code-row{display:grid;grid-template-columns:minmax(220px,1fr) minmax(130px,190px) auto;gap:8px;align-items:center;padding:8px 10px;border-bottom:1px solid #eef2f7}
  .finished-identity-code-row>div{display:flex;flex-direction:column;gap:2px;min-width:0}
  .finished-identity-code-row strong{font-size:12px;color:#1f2937;overflow-wrap:anywhere}
  .finished-identity-code-row span{font-size:10px;color:#64748b}
  .finished-identity-code-row input{min-width:0;padding:7px 8px;border:1px solid #93c5fd;border-radius:7px;color:#1e293b;background:#fff}
  .finished-identity-group{margin-top:10px;padding:10px;border:1px solid #cbd5e1;border-radius:9px;background:#fff}
  .finished-identity-group-head{display:flex;justify-content:space-between;gap:10px;align-items:baseline;margin-bottom:8px}
  .finished-identity-group-head>div{display:flex;align-items:baseline;gap:8px;min-width:0}
  .finished-identity-group-head strong{font-size:13px;color:#1f2937;overflow-wrap:anywhere}
  .finished-identity-group-head span{font-size:11px;color:#64748b;white-space:nowrap}
  .finished-identity-warning{padding:7px 9px;border-radius:7px;background:#fff7ed;color:#9a3412;font-size:11px;line-height:1.5}
  .finished-identity-reasons{margin:8px 0 12px;padding:8px 10px 8px 28px;border:1px solid #fdba74;border-radius:7px;background:#fff7ed;color:#9a3412;font-size:11px;line-height:1.6}
  .finished-identity-table-wrap{overflow-x:auto;margin-top:8px}
  .finished-identity-table{width:100%;border-collapse:collapse;min-width:470px;font-size:12px}
  .finished-identity-table th,.finished-identity-table td{padding:6px 7px;border-bottom:1px solid #eef2f7;text-align:left;vertical-align:top}
  .finished-identity-table th{color:#64748b;font-weight:700;background:#f8fafc;white-space:nowrap}
  .finished-identity-table td:first-child{font-weight:600;color:#1f2937;overflow-wrap:anywhere}
  .finished-identity-number{text-align:right!important;white-space:nowrap;color:#1d4ed8;font-weight:600}
  .finished-identity-action{display:grid;grid-template-columns:minmax(0,1fr) minmax(160px,1.5fr) auto;gap:8px;align-items:end;margin-top:10px}
  .finished-identity-action label{font-size:11px;color:#64748b;padding-bottom:8px}
  .finished-identity-action select{width:100%;min-width:0;padding:8px 9px;border:1px solid #93c5fd;border-radius:7px;background:#fff;color:#1e293b;font:inherit}
  .finished-identity-action .btn{min-height:35px;white-space:nowrap}
  .finished-identity-action button:disabled,.finished-identity-action select:disabled{cursor:not-allowed;opacity:.58}
  .finished-identity-readonly{margin-top:10px;padding:8px 10px;border-radius:7px;background:#f1f5f9;color:#64748b;font-size:11px}
  .finished-identity-impact{margin:8px 0 0;color:#64748b;font-size:11px;line-height:1.5}
  @media(max-width:700px){.inventory-health{grid-template-columns:repeat(2,minmax(0,1fr))}.inventory-health-item:last-child{grid-column:1/-1}}
  @media(max-width:600px){.finished-identity-group-head{display:block}.finished-identity-group-head>div{margin-bottom:3px}.finished-identity-group-head>span{display:block;white-space:normal}.finished-identity-action{grid-template-columns:1fr}.finished-identity-action label{padding-bottom:0}.finished-identity-action .btn{width:100%}.finished-identity-code-row{grid-template-columns:1fr auto}.finished-identity-code-row>div{grid-column:1/-1}.finished-identity-code-list{max-height:60vh}}
  @media(max-width:700px){
    .warehouse-reconcile-overlay{align-items:flex-start;padding:8px 8px calc(8px + env(safe-area-inset-bottom))}
    .warehouse-reconcile-head{position:sticky;top:0;z-index:2;background:#fff;border-radius:14px 14px 0 0}
    .warehouse-reconcile-dialog .dialog-actions{grid-template-columns:1fr 1fr}
  }
  @media(max-width:520px){.warehouse-reconcile-row{grid-template-columns:1fr 90px}.warehouse-reconcile-row .warehouse-reconcile-available{grid-column:1/-1;font-size:12px;color:#64748b}.warehouse-move-fields{grid-template-columns:1fr}.warehouse-move-route{grid-template-columns:1fr 26px 1fr}.warehouse-package-head{align-items:flex-start}.warehouse-package-row{grid-template-columns:minmax(60px,1fr) 16px minmax(80px,1fr) 26px}.warehouse-package-subtotal{grid-column:1/-1;padding:0 0 0 2px}.warehouse-package-remove{grid-column:4;grid-row:1;padding-top:14px}.warehouse-package-row label:nth-of-type(2){grid-column:3}.warehouse-package-times{grid-column:2}}
  @media(max-width:700px){.warehouse-lane{flex-basis:88vw;max-width:340px;min-height:280px}.warehouse-column-ruler-cell{flex-basis:min(88vw,340px);width:min(88vw,340px)}.warehouse-item-go{display:inline-flex;align-items:center;justify-content:center;width:100%;min-width:0;min-height:27px;box-sizing:border-box;margin:0;font-size:clamp(9px,2.7vw,10px);font-weight:700;color:var(--accent);background:var(--accent-soft);border-radius:7px;padding:3px 4px;white-space:nowrap;overflow:hidden}.warehouse-add-cell{flex-basis:112px;min-height:88px}.warehouse-add-cell.open{flex-basis:170px}.warehouse-lane-cards{min-height:0;max-height:60vh}.warehouse-empty{min-height:120px}.warehouse-item{padding:10px 8px}.warehouse-reconcile-overlay.keyboard-fallback{align-items:flex-start}.warehouse-reconcile-overlay.keyboard-fallback .warehouse-reconcile-dialog{max-height:56%}
  /* 未分配区在窄屏（≤375px：iPhone SE/8/13 mini 等）上，auto-fill minmax(150px,1fr)
     算不出两列会塌成一列：卡片横跨整行、文字短的右边空一大片，
     而下方普通库位仍是两列，看着更别扭。这里跟普通库位统一钉死两列。 */
  .warehouse-lane.unassigned .warehouse-lane-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
  /* 未分配泳道 flex:1 1 auto 会被撑到「最宽那一排」的宽度（实测 375 屏上宽 513px，
     而可视区只有 333px），于是右边多出一大片空白要横滑才看得到。
     手机上改为跟随可视宽度，不参与横向网格的宽度撑开。 */
  .warehouse-lane.unassigned{flex:0 0 auto;width:100%;max-width:100%}
  .unassigned-row .warehouse-row{width:auto;min-width:0}
  /* 卡片区高度改为按内容撑开：只放 3 种料的库位不再强占 208px 留下大片空白 */
  .warehouse-lane{min-height:0}}

/* 版本徽章沉到侧栏最底下，别跟菜单抢注意力：margin-top:auto 要求 .sidenav 是纵向 flex */
.app-version-badge{flex:0 0 auto;margin:auto 12px 14px;padding:4px 6px;border:1px solid rgba(255,255,255,.10);border-radius:6px;background:transparent;color:rgba(255,255,255,.42);font:500 9px/1.3 inherit;cursor:pointer;text-align:center;overflow-wrap:anywhere}
.app-version-badge:hover{background:rgba(255,255,255,.10);color:rgba(255,255,255,.85)}
.app-version-badge.unregistered{border-color:#fca5a5;background:#7f1d1d;color:#fee2e2}
@media(max-width:700px){.app-version-badge{display:none}}
  .legacy-production-panel{margin-top:14px;border:1px solid var(--line);border-radius:10px;background:rgba(248,250,252,.72);overflow:hidden}
  .legacy-production-panel>summary{cursor:pointer;padding:12px 14px;color:#475569;font-size:13px;font-weight:700;list-style-position:inside}
  .legacy-production-panel[open]>summary{border-bottom:1px solid var(--line);background:#f8fafc}
  .legacy-production-panel>summary::marker{color:var(--accent)}
  .customer-order-empty{padding:14px;border:1px dashed #cbd5e1;border-radius:8px;color:#64748b;font-size:12px;text-align:center}
  .customer-order-error{color:#b91c1c;background:#fff7ed;border-color:#fdba74}
  .customer-order-row{padding:13px 0;border-top:1px solid #e5e7eb}
  .customer-order-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
  .customer-order-head>div{min-width:0;display:flex;flex-direction:column;gap:3px}
  .customer-order-head strong{color:#1e3a5f;font-size:14px}
  .customer-order-head span{color:#334155;font-size:13px;overflow-wrap:anywhere}
  .customer-order-status{display:inline-flex;align-items:center;padding:3px 8px;border-radius:999px;white-space:nowrap;font-size:11px;background:#dbeafe;color:#1d4ed8}
  .customer-order-status.success{background:#dcfce7;color:#15803d}.customer-order-status.warning{background:#fef3c7;color:#92400e}.customer-order-status.muted{background:#f1f5f9;color:#64748b}
  .customer-order-meta{display:flex;gap:8px 18px;flex-wrap:wrap;margin-top:8px;color:#64748b;font-size:12px;line-height:1.5}
  .customer-order-link{margin-top:7px;padding:6px 8px;border-radius:6px;background:#eff6ff;color:#1d4ed8;font-size:12px}
  .customer-order-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:10px}
  .customer-order-btn{min-height:30px;padding:5px 10px;font-size:12px}
  .customer-order-item-entry{display:grid;grid-template-columns:minmax(180px,2fr) minmax(110px,1fr) minmax(90px,.8fr) minmax(90px,.7fr) auto;gap:8px;margin-bottom:8px;align-items:center}
  .customer-order-item-summary{display:grid;grid-template-columns:minmax(150px,2fr) repeat(5,minmax(70px,1fr));gap:8px;padding:6px 8px;background:#f8f7ff;border-radius:6px;font-size:12px}
  .customer-order-item-stock small{display:block;color:#6b7280;font-size:11px}
  @media(max-width:600px){.customer-order-head{display:block}.customer-order-status{margin-top:7px}.customer-order-actions .customer-order-btn{flex:1 1 calc(50% - 7px)}.customer-order-item-entry{grid-template-columns:1fr 1fr}.customer-order-item-entry input:first-child{grid-column:1/-1}.customer-order-item-entry .btn{grid-column:1/-1}.customer-order-item-summary{grid-template-columns:1fr 1fr}.customer-order-item-summary b{grid-column:1/-1}}

  /* 库存调整出库的原因：常用的点一下就填好 */
  .warehouse-reason{margin-top:12px}
  .warehouse-reason label{display:block;color:#475569;font-size:12px;font-weight:600;margin-bottom:6px}
  .warehouse-reason-chips{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:7px}
  .warehouse-reason-chip{border:1px solid #cbd5e1;border-radius:999px;background:#f8fafc;color:#334155;padding:5px 11px;font:600 12px/1.3 inherit;cursor:pointer}
  .warehouse-reason-chip:hover,.warehouse-reason-chip:focus-visible{border-color:var(--accent);background:#eef2ff;color:#3730a3;outline:none}
  .warehouse-reason input{width:100%;box-sizing:border-box;padding:9px 10px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:#1e293b;-webkit-text-fill-color:#1e293b;font-family:inherit;font-size:14px}

  /* ===== 送货单 ===== */
  .delivery-row{border:1px solid #e2e8f0;border-radius:11px;padding:11px 13px;margin-bottom:10px;background:#fff}
  .delivery-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
  .delivery-no{font:800 15px/1.3 inherit;color:#4c3ca6}
  .delivery-head span{color:#64748b;font-size:12px}
  .delivery-meta{display:flex;flex-wrap:wrap;gap:10px;margin-top:6px;color:#64748b;font-size:12px}
  .delivery-lines{margin-top:8px;display:grid;gap:4px}
  .delivery-line{display:grid;grid-template-columns:minmax(120px,1.6fr) minmax(90px,1fr) minmax(80px,1fr) 78px;gap:8px;align-items:center;padding:6px 8px;border-radius:7px;background:#f8fafc;font-size:12px}
  .delivery-line b{font-size:13px;color:#1e293b;overflow-wrap:anywhere}
  .delivery-line small{color:#64748b}
  .delivery-empty{padding:16px;border:1px dashed #dbe4f0;border-radius:10px;color:#94a3b8;font-size:13px;text-align:center}
  .delivery-form-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
  .delivery-form-grid label{display:block;color:#475569;font-size:12px;font-weight:600;margin-bottom:4px}
  .delivery-form-grid input{width:100%;box-sizing:border-box;padding:8px 10px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:#1e293b;-webkit-text-fill-color:#1e293b;font-family:inherit;font-size:14px}
  .delivery-pick{margin-top:12px;border-top:1px dashed #d8d5f2;padding-top:10px}
  #deliveryOverlay .warehouse-reconcile-dialog{width:min(840px,100%);max-width:840px}
  #deliveryOverlay .delivery-mode-tabs{display:flex;flex-wrap:wrap;gap:10px;margin-top:16px}
  #deliveryOverlay .delivery-pick-fields{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
  #deliveryStockSection .delivery-pick-fields>div:first-child{grid-column:span 2}
  @media(max-width:700px){
    #deliveryOverlay .delivery-pick-fields{grid-template-columns:repeat(2,minmax(0,1fr))}
    #deliveryStockSection .delivery-pick-fields>div:first-child{grid-column:1/-1}
    #deliveryOverlay .delivery-mode-tabs .btn{flex:1}
  }
  .delivery-pick-row{border:1px solid #e2e8f0;border-radius:9px;padding:8px 10px;margin-bottom:8px;background:#fff}
  .delivery-pick-row.picked{border-color:#a5b4fc;background:#f5f6ff}
  .delivery-pick-row.blocked{opacity:.5}
  .delivery-pick-title{display:flex;align-items:flex-start;gap:8px;font-size:13px;line-height:1.4}
  .delivery-pick-title input[type=checkbox]{margin-top:3px;width:16px;height:16px;flex:none}
  .delivery-pick-title b{overflow-wrap:anywhere}
  .delivery-pick-title small{display:block;color:#64748b;font-size:11px;margin-top:2px}
  .delivery-pick-fields{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;margin-top:8px}
  .delivery-pick-fields label{display:block;color:#64748b;font-size:11px;margin-bottom:3px}
  .delivery-pick-fields input,.delivery-pick-fields select{width:100%;box-sizing:border-box;padding:7px 8px;border:1px solid #cbd5e1;border-radius:7px;background:#fff;color:#1e293b;-webkit-text-fill-color:#1e293b;font-family:inherit;font-size:13px}
  @media (max-width: 768px){
    .delivery-form-grid{grid-template-columns:1fr 1fr}
    .delivery-pick-fields{grid-template-columns:1fr 1fr}
    .delivery-line{grid-template-columns:1fr 1fr}
  }

  /* 宽表格横向拖动（工单利润表 / 支出明细）：手感与成品库存库位图一致 */
  .table-pan.pannable{cursor:grab}
  .table-pan.panning{cursor:grabbing;scroll-behavior:auto;user-select:none}
  .table-pan.panning input,.table-pan.panning a{pointer-events:none}

/* ===== 全局 AI 助手（第三阶段） ===== */
.global-ai-launcher{position:fixed;right:22px;bottom:24px;z-index:3180;display:inline-flex;align-items:center;gap:8px;min-height:42px;padding:7px 14px 7px 8px;border:0;border-radius:999px;background:linear-gradient(135deg,#4f46e5,#2563eb);color:#fff;box-shadow:0 12px 30px rgba(37,99,235,.28);font:700 13px/1.2 inherit;cursor:pointer}
.global-ai-launcher[hidden]{display:none!important}
.global-ai-launcher:hover{transform:translateY(-1px);box-shadow:0 15px 34px rgba(37,99,235,.34)}
.global-ai-launcher-mark{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;background:rgba(255,255,255,.18);font-size:11px;letter-spacing:.04em}
.global-ai-backdrop{position:fixed;inset:0;z-index:3185;background:rgba(15,23,42,.28);opacity:0;visibility:hidden;transition:opacity .18s ease,visibility .18s ease}
.global-ai-backdrop.open{opacity:1;visibility:visible}
.global-ai-panel{position:fixed;z-index:3190;top:0;right:0;bottom:0;width:min(430px,100vw);box-sizing:border-box;display:flex;flex-direction:column;background:#f8fafc;color:#1e293b;border-left:1px solid #dbe4f0;box-shadow:-20px 0 50px rgba(15,23,42,.18);transform:translateX(104%);visibility:hidden;transition:transform .22s ease,visibility .22s ease}
.global-ai-panel.open{transform:translateX(0);visibility:visible}
.global-ai-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:18px 18px 13px;background:#fff;border-bottom:1px solid #e2e8f0}
.global-ai-head strong{display:block;color:#1e293b;font-size:17px}
.global-ai-head small{display:block;margin-top:4px;color:#64748b;font-size:11px;font-weight:500}
.global-ai-head>button{border:0;background:transparent;color:#64748b;font:400 27px/1 inherit;cursor:pointer;padding:0 3px}
.global-ai-context{display:flex;align-items:center;gap:6px;flex-wrap:wrap;padding:10px 18px;background:#fff;border-bottom:1px solid #edf2f7}
.global-ai-context span,.global-ai-context button,.global-ai-context em{display:inline-flex;align-items:center;max-width:100%;padding:3px 8px;border-radius:999px;background:#eef2ff;color:#4338ca;font-size:11px;font-style:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.global-ai-context #globalAIRecordContext{border:0;background:#e0f2fe;color:#0369a1;font-family:inherit;cursor:pointer}
.global-ai-context em{margin-left:auto;background:#dcfce7;color:#15803d}
.global-ai-prompts{display:flex;gap:6px;overflow-x:auto;padding:10px 18px 8px;scrollbar-width:thin}
.global-ai-prompts button{flex:0 0 auto;border:1px solid #c7d2fe;border-radius:999px;background:#fff;color:#4338ca;padding:6px 10px;font:600 11px/1.25 inherit;cursor:pointer}
.global-ai-prompts button:hover{background:#eef2ff}
.global-ai-results{flex:1;min-height:0;overflow-y:auto;padding:8px 18px 18px}
.global-ai-empty{margin-top:10px;padding:14px;border:1px dashed #cbd5e1;border-radius:10px;background:#fff;color:#64748b;font-size:12px;line-height:1.65}
.global-ai-result{margin-top:10px;padding:12px;border:1px solid #e2e8f0;border-radius:12px;background:#fff;box-shadow:0 4px 14px rgba(15,23,42,.04)}
.global-ai-question{margin-bottom:8px;color:#4338ca;font-size:12px;font-weight:800}
.global-ai-question::before{content:'问：'}
.global-ai-answer{color:#1e293b;font-size:13px;line-height:1.7;overflow-wrap:anywhere}
.global-ai-meta{margin-top:7px;color:#64748b;font-size:11px;line-height:1.5}
.global-ai-record-link{margin-top:8px;border:0;border-radius:7px;background:#e0f2fe;color:#0369a1;padding:6px 9px;font:600 11px/1.3 inherit;cursor:pointer}
.global-ai-error,.global-ai-warning{margin-top:6px;padding:7px 8px;border-radius:7px;background:#fff7ed;color:#b45309;font-size:12px;line-height:1.5}
.global-ai-error{background:#fef2f2;color:#b91c1c}
.global-ai-table{max-height:260px;margin-top:10px;overflow:auto;border:1px solid #e2e8f0;border-radius:8px}
.global-ai-table table{width:100%;border-collapse:collapse;font-size:11px}
.global-ai-table th,.global-ai-table td{padding:6px 8px;border-bottom:1px solid #eef2f7;text-align:left;white-space:nowrap}
.global-ai-table th{position:sticky;top:0;background:#f8fafc;color:#475569}
.global-ai-export{margin-top:8px;border:1px solid #c7d2fe;border-radius:7px;background:#fff;color:#4338ca;padding:5px 9px;font:600 11px/1.2 inherit;cursor:pointer}
.global-ai-compose{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px;padding:12px 14px calc(12px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid #e2e8f0}
.global-ai-compose textarea{width:100%;min-height:42px;max-height:120px;box-sizing:border-box;resize:vertical;border:1px solid #cbd5e1;border-radius:9px;background:#fff;color:#1e293b;-webkit-text-fill-color:#1e293b;padding:9px 10px;font:13px/1.45 inherit}
.global-ai-compose textarea:focus{border-color:#6366f1;outline:2px solid rgba(99,102,241,.12)}
.global-ai-compose button{align-self:stretch;min-width:62px;border:0;border-radius:9px;background:#4f46e5;color:#fff;font:700 13px/1 inherit;cursor:pointer}
.global-ai-compose button.secondary{background:#e0e7ff;color:#3730a3}
.global-ai-compose button:disabled{cursor:wait;opacity:.65}
.global-ai-action-buttons{display:flex;gap:8px;align-items:center;margin-top:10px}
.global-ai-action-buttons button{border:0;border-radius:8px;padding:8px 12px;background:#4f46e5;color:#fff;font:700 12px/1 inherit;cursor:pointer}
.global-ai-action-buttons button.secondary{background:#e2e8f0;color:#334155}
.global-ai-action-buttons button:disabled{cursor:wait;opacity:.65}
.global-ai-action-success{color:#15803d;font-size:12px;font-weight:700}
@media(max-width:700px){
  body.global-ai-open{overflow:hidden}
  .global-ai-launcher{right:12px;bottom:calc(76px + env(safe-area-inset-bottom));padding-right:10px}
  .global-ai-launcher>span:last-child{display:none}
  .global-ai-panel{width:100vw;border-left:0}
  .global-ai-head{padding-top:calc(14px + env(safe-area-inset-top))}
  .global-ai-context em{margin-left:0}
}

/* Product evidence cards: shared by the assistant and inventory. */
.product-insight-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,310px),1fr));gap:12px;margin:12px 0}
.product-insight-card{min-width:0;padding:15px;border:1px solid var(--border-color,#dce4ec);border-radius:12px;background:var(--card-bg,#fff);color:var(--text-color,#243547);overflow-wrap:anywhere;font-size:13px}
.product-insight-card header{display:flex;gap:12px;align-items:center}
.product-insight-card header>.vw-product-photo{width:76px;height:76px;flex:0 0 76px}
.product-insight-card header img,.product-insight-no-photo{width:76px;height:76px;flex:0 0 76px;object-fit:contain;border-radius:8px;background:#f3f6f8}
.product-insight-no-photo{display:grid;place-items:center;color:#728093;font-size:12px}
.product-insight-card h3{margin:0;font-size:16px;line-height:1.5}
.product-insight-card h4{margin:12px 0 8px;font-size:14px}
.product-insight-card p{margin:7px 0;line-height:1.6}
.product-insight-card header strong{font-size:21px;color:var(--primary,#245fb5)}
.product-insight-card dl{margin:0;display:grid;grid-template-columns:1fr 1fr;gap:8px}
.product-insight-card dt{font-size:11px;color:#66788b}
.product-insight-card dd{margin:2px 0 0}
.product-capacity{margin-top:10px;padding:10px;border-radius:8px;background:var(--bg-color,#f0f5fa)}
.product-capacity small,.product-insight-source{color:#607083;font-size:11px}
.product-insight-warnings{padding-left:18px;color:#8a5a20;line-height:1.6}
.product-insight-card button{cursor:pointer;white-space:normal}
.product-insight-card>.btn{margin-top:10px;width:100%}
.product-insight-source button{border:0;background:none;color:var(--primary,#245fb5);text-decoration:underline}
.inventory-production-detail{margin:0 0 12px}
.inventory-production-detail>summary{cursor:pointer;font-weight:600;margin-bottom:8px}
#productInsightOverlay .warehouse-reconcile-dialog{max-width:620px}
@media(max-width:480px){.product-insight-card{padding:12px}.product-insight-card dl{grid-template-columns:1fr}}
.ai-navigation-notice{margin:0 0 16px;padding:14px 16px;border:1px solid var(--border,#e5e7eb);border-radius:14px;background:var(--card-bg,#fff);color:var(--text,#1f2937);overflow-wrap:anywhere}
.ai-navigation-notice>strong{display:block;margin-bottom:8px}.ai-navigation-notice summary{cursor:pointer;font-size:13px}.ai-navigation-notice p{white-space:pre-line;line-height:1.7;font-size:13px}.ai-navigation-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}.ai-navigation-actions .btn{font-size:12px;padding:6px 10px}
@media print{.ai-navigation-notice{display:none!important}}
.order-image-slot{border:1px solid var(--border,#d9dfe8);border-radius:8px;padding:10px 12px;margin:8px 0;background:var(--surface,#fff)}
.order-image-slot strong{font-size:13px;margin-right:8px}
.order-image-slot .btn{padding:4px 10px;font-size:12px}
.order-image-list{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
/* 月度固定费用：金额编辑与预估状态，手机按两列/单列展示。 */
.fixed-expense-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.fixed-expense-grid label { display:flex; flex-direction:column; gap:6px; font-size:13px; }
.fixed-expense-grid input { width:100%; box-sizing:border-box; padding:10px; border:1px solid var(--input-border,#cbd5e1); border-radius:8px; color:#1e293b; -webkit-text-fill-color:#1e293b; background:#fff; }
.fixed-expense-help { font-size:12px; color:var(--muted,#64748b); line-height:1.65; }
.fixed-expense-actions { margin-top:14px; flex-wrap:wrap; gap:12px; }
.fixed-expense-badge { display:inline-block; margin-left:6px; padding:2px 6px; border-radius:6px; background:#fff7ed; color:#9a3412; font-size:11px; white-space:nowrap; }
@media(max-width:768px) { .fixed-expense-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:360px) { .fixed-expense-grid { grid-template-columns:minmax(0,1fr); } }
/* 原料采购成本：入库页和库位弹窗共用，不压缩手机输入框。 */
.material-purchase-fields { grid-column: 1 / -1; padding: 14px; border: 1px solid var(--line, #dbe5ef); border-radius: 12px; background: var(--hover-bg, #f8fbff); color: var(--ink, #1e293b); }
.material-purchase-fields[hidden], .material-purchase-receipt[hidden] { display: none; }
.material-purchase-fields p { margin: 7px 0 12px; font-size: 12px; line-height: 1.65; color: var(--muted, #64748b); }
.material-purchase-fields input { min-width: 0; width: 100%; color: var(--ink, #1e293b); background: var(--hover-bg, #fff); }
.material-purchase-receipt { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--muted, #64748b); font-size: 13px; }
@media (max-width: 600px) { .material-purchase-fields .form-grid { grid-template-columns: 1fr; } }
