/* MES System Styles */
/* ============================================
   全局样式
   ============================================ */
* { margin:0; padding:0; box-sizing:border-box; }
:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --success: #0d904f;
  --warning: #e67e22;
  --danger: #d93025;
  --bg: #f0f2f5;
  --card: #fff;
  --border: #e0e0e0;
  --text: #333;
  --text-secondary: #666;
  --sidebar-width: 180px;
  --header-height: 56px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif; background:var(--bg); color:var(--text); min-height:100vh; }

/* ============================================
   登录页
   ============================================ */
.login-container { display:flex; justify-content:center; align-items:center; min-height:100vh; background:linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%); }
.login-box { background:#fff; padding:40px; border-radius:12px; box-shadow:0 8px 32px rgba(0,0,0,0.2); width:400px; }
.login-box h1 { text-align:center; margin-bottom:8px; font-size:22px; color:#1a73e8; }
.login-box .subtitle { text-align:center; color:#666; margin-bottom:32px; font-size:14px; }
.login-box label { display:block; margin-bottom:6px; font-weight:500; font-size:14px; }
.login-box input { width:100%; padding:10px 12px; border:1px solid #ddd; border-radius:6px; font-size:14px; margin-bottom:20px; outline:none; }
.login-box input:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(26,115,232,0.15); }
.login-box .login-remember { display:flex; align-items:center; gap:8px; width:max-content; margin:-6px 0 18px; color:#52645e; cursor:pointer; font-weight:500; }
.login-box .login-remember input { width:18px; height:18px; margin:0; accent-color:var(--primary); }
.login-box button { width:100%; padding:12px; background:var(--primary); color:#fff; border:none; border-radius:6px; font-size:16px; cursor:pointer; font-weight:500; }
.login-box button:hover { background:var(--primary-dark); }
.login-box .error-msg { color:var(--danger); text-align:center; margin-top:10px; font-size:13px; display:none; }

/* ============================================
   主布局
   ============================================ */
.app-container { display:none; }
.app-container.show { display:flex; }
.sidebar { width:var(--sidebar-width); height:100vh; background:#1e293b; position:fixed; left:0; top:0; overflow-y:auto; z-index:100; transition:width 0.2s; }
.main-content { transition:margin-left 0.2s; }
.sidebar-logo { padding:18px 16px; color:#fff; font-size:17px; font-weight:700; border-bottom:1px solid rgba(255,255,255,0.1); text-align:center; line-height:1.4; }
.sidebar-menu { padding:8px 0; }
.sidebar-menu .menu-group { padding:12px 16px 4px; color:rgba(255,255,255,0.4); font-size:11px; text-transform:uppercase; letter-spacing:1px; }
.sidebar-menu a { display:flex; align-items:center; gap:10px; padding:10px 16px; color:rgba(255,255,255,0.7); text-decoration:none; font-size:14px; transition:all 0.2s; border-left:3px solid transparent; }
.sidebar-menu a:hover, .sidebar-menu a.active { color:#fff; background:rgba(255,255,255,0.08); border-left-color:var(--primary); }
.sidebar-menu a .icon { width:20px; text-align:center; font-size:15px; }

.main-content { margin-left:var(--sidebar-width); flex:1; min-height:100vh; }
.header { height:var(--header-height); background:#fff; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; padding:0 24px; position:sticky; top:0; z-index:50; }
.header .user-info { display:flex; align-items:center; gap:12px; font-size:14px; }
.header .user-info .role-badge { padding:2px 10px; border-radius:12px; font-size:12px; background:#e8f0fe; color:var(--primary); }
.header button { padding:6px 16px; border:1px solid #ddd; background:#fff; border-radius:6px; cursor:pointer; font-size:13px; }
.header button:hover { background:#f5f5f5; }

.page { padding:24px; display:none; }
.page.active { display:block; }

.page.orders-page {
  width: 100%;
  max-width: none;
  min-height: calc(100vh - var(--header-height));
  padding: 0;
}
.page.orders-page > .card {
  min-height: calc(100vh - var(--header-height));
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}
.page.orders-page > .card:hover { box-shadow: none; }
.page.orders-page > .card > .card-header { border-radius: 0; }
.page.orders-page .table-scroll th:last-child,
.page.orders-page .table-scroll td:last-child {
  position: sticky;
  right: 0;
  box-shadow: -4px 0 7px rgba(38,64,55,.08);
}
.page.orders-page .table-scroll th:last-child {
  z-index: 12;
  background: #edf3f0;
}
.page.orders-page .table-scroll tbody tr:nth-child(odd) td:last-child { background: #fff; }
.page.orders-page .table-scroll tbody tr:nth-child(even) td:last-child { background: #fbfcfb; }
.page.orders-page .table-scroll tbody tr:hover td:last-child { background: #edf7f2 !important; }

/* ============================================
   通用组件
   ============================================ */
.card { background:var(--card); border-radius:10px; box-shadow:0 1px 3px rgba(0,0,0,0.08); margin-bottom:20px; }
.card-header { padding:16px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; font-weight:600; font-size:15px; }
.card-body { padding:20px; }

.stats-row { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:16px; margin-bottom:20px; }
.stat-card { background:var(--card); border-radius:10px; padding:20px; box-shadow:0 1px 3px rgba(0,0,0,0.08); }
.stat-card .stat-value { font-size:28px; font-weight:700; color:var(--primary); }
.stat-card .stat-label { color:var(--text-secondary); font-size:13px; margin-top:4px; }

table { width:100%; border-collapse:collapse; font-size:13px; }
th { background:#f8f9fa; padding:10px 12px; text-align:left; font-weight:600; border-bottom:2px solid var(--border); white-space:nowrap; }
td { padding:10px 12px; border-bottom:1px solid var(--border); }
tr:hover td { background:#f8f9ff; }

/* 可横向滚动的表格容器 */
.table-scroll { overflow-x:auto; -webkit-overflow-scrolling:touch; max-width:100%; border:1px solid var(--border); border-radius:6px; }
.table-scroll table { width:auto; min-width:100%; table-layout:auto; margin-bottom:0; }
/* 列宽拖拽柄 */
.col-resize-handle { position:absolute; right:0; top:0; bottom:0; width:8px; cursor:col-resize; z-index:2; }
.col-resize-handle:hover, .col-resize-handle:active { background:rgba(26,115,232,0.2); }
.resizing { user-select:none !important; cursor:col-resize !important; }

.btn { padding:8px 18px; border:none; border-radius:6px; cursor:pointer; font-size:13px; font-weight:500; display:inline-flex; align-items:center; gap:6px; transition:all 0.2s; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-dark); }
.btn-success { background:var(--success); color:#fff; }
.btn-success:hover { opacity:0.9; }
.btn-warning { background:var(--warning); color:#fff; }
.btn-danger { background:var(--danger); color:#fff; }
.btn-outline { background:#fff; color:var(--primary); border:1px solid var(--primary); }
.btn-sm { padding:4px 10px; font-size:12px; }

.badge { display:inline-block; padding:2px 10px; border-radius:12px; font-size:11px; font-weight:500; }
.badge-success { background:#e6f4ea; color:#0d904f; }
.badge-warning { background:#fef3e0; color:#e67e22; }
.badge-danger { background:#fce8e6; color:#d93025; }
.badge-info { background:#e8f0fe; color:#1a73e8; }
.badge-default { background:#f0f0f0; color:#666; }

.search-bar { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-bottom:16px; }
.search-bar input, .search-bar select { padding:8px 12px; border:1px solid #ddd; border-radius:6px; font-size:13px; outline:none; }
.search-bar input:focus, .search-bar select:focus { border-color:var(--primary); }

.modal-overlay { position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.5); z-index:2400; display:none; justify-content:center; align-items:center; }
.modal-overlay.show { display:flex; }
.modal { background:#fff; border-radius:12px; width:90%; max-width:700px; max-height:85vh; overflow-y:auto; box-shadow:0 8px 32px rgba(0,0,0,0.2); }
.modal-header { padding:16px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; font-weight:600; font-size:16px; }
.modal-header .close-btn { background:none; border:none; font-size:20px; cursor:pointer; color:#666; }
.modal-body { padding:20px; }
.modal-footer { padding:16px 20px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:10px; }

/* Shared sorting/packing safety gate for incomplete drilling operations. */
.modal.hole-quality-modal { width: min(980px, calc(100vw - 28px)); max-width: 980px; }
.hole-quality-header { background: #fff1ef; color: #8f251f; }
.hole-quality-header span { display: inline-flex; align-items: center; gap: 8px; }
.hole-quality-header svg { width: 19px; height: 19px; }
.hole-quality-body { display: grid; gap: 12px; background: #f7faf8; }
.hole-quality-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border: 1px solid #d7e0dc; background: #fff; }
.hole-quality-summary div { min-width: 0; display: grid; gap: 3px; }
.hole-quality-summary b { color: #172d25; font-size: 17px; }
.hole-quality-summary span { overflow: hidden; color: #66746e; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.hole-quality-summary strong { flex: 0 0 auto; color: #b92d26; font-size: 17px; }
.hole-quality-state-note { display: flex; align-items: flex-start; gap: 12px; min-height: 150px; padding: 28px; border: 1px solid #e4c77c; background: #fffaf0; color: #6d531a; }
.hole-quality-state-note > svg { flex: 0 0 auto; width: 28px; height: 28px; margin-top: 2px; }
.hole-quality-state-note > div { display: grid; gap: 8px; }
.hole-quality-state-note b { color: #4b390f; font-size: 18px; }
.hole-quality-state-note span { font-size: 14px; line-height: 1.65; }
.hole-quality-state-note small { color: #806b3c; font-size: 12px; }
.hole-quality-faces { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.hole-quality-faces li { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border-left: 3px solid #d23d34; background: #fff; box-shadow: inset 0 0 0 1px #dde4e1; }
.hole-quality-faces b { color: #263b33; }
.hole-quality-faces span { color: #9b2e28; font-weight: 700; }
.hole-quality-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.hole-quality-action { display: grid; place-items: center; gap: 7px; min-width: 0; padding: 10px 8px 8px; border: 1px solid #c9d4cf; background: #fff; }
.hole-quality-action > button { width: 100%; min-height: 39px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 3px; color: #fff; font-weight: 800; }
.hole-quality-action > button em { width: 21px; height: 21px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; font-size: 11px; font-style: normal; }
.hole-quality-action > button svg { width: 17px; height: 17px; }
.hole-quality-action > div { width: 88px; height: 88px; }
.hole-quality-action img, .hole-quality-action canvas { width: 88px !important; height: 88px !important; }
.hole-quality-action small { max-width: 100%; color: #68756f; font: 10px Consolas, monospace; overflow-wrap: anywhere; }
.hole-quality-action.is-drill > button { background: #2563a6; }
.hole-quality-action.is-manual > button { background: #b65d11; }
.hole-quality-action.is-pending > button { background: #626d68; }
.hole-quality-action.is-complete > button { background: #15704f; }
.hole-quality-footer { justify-content: space-between; }
.hole-quality-footer button { display: inline-flex; align-items: center; gap: 6px; }
.hole-quality-footer svg { width: 15px; height: 15px; }
.hole-quality-rescan { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 16px; min-height: 104px; padding: 14px 18px; border: 2px solid #d18426; background: #fff8eb; }
.hole-quality-rescan > strong { width: 68px; height: 68px; display: grid; place-items: center; border: 3px solid #c76c18; border-radius: 50%; color: #a9470c; background: #fff; font-size: 30px; line-height: 1; }
.hole-quality-rescan > div { display: grid; gap: 7px; min-width: 0; }
.hole-quality-rescan b { color: #713b10; font-size: 20px; }
.hole-quality-rescan span { color: #765d42; font-size: 14px; line-height: 1.55; }
.hole-quality-rescan.is-ready { border-color: #178155; background: #edf9f4; }
.hole-quality-rescan.is-ready > strong { border-color: #178155; color: #126a47; }
.hole-quality-rescan.is-ready b { color: #125f42; }
.hole-quality-rescan-footer { align-items: center; }
.hole-quality-rescan-footer > span { color: #8d3c18; font-size: 13px; font-weight: 700; }
@media (max-width: 760px) {
  .hole-quality-actions { grid-template-columns: 1fr 1fr; }
  .hole-quality-summary { align-items: flex-start; flex-direction: column; }
  .hole-quality-rescan { grid-template-columns: 58px minmax(0, 1fr); gap: 10px; padding: 12px; }
  .hole-quality-rescan > strong { width: 52px; height: 52px; font-size: 23px; }
  .hole-quality-rescan b { font-size: 17px; }
}

.form-group { margin-bottom:16px; }
.form-group label { display:block; margin-bottom:6px; font-weight:500; font-size:13px; }
.form-group input, .form-group select, .form-group textarea { width:100%; padding:8px 12px; border:1px solid #ddd; border-radius:6px; font-size:13px; outline:none; }
.form-group textarea { min-height:80px; resize:vertical; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; }

.pagination { display:flex; justify-content:center; align-items:center; gap:8px; margin-top:16px; }
.pagination button { padding:6px 12px; border:1px solid #ddd; background:#fff; border-radius:6px; cursor:pointer; font-size:13px; }
.pagination button:hover:not(:disabled) { background:#f0f0f0; }
.pagination button:disabled { opacity:0.5; cursor:default; }
.pagination span { font-size:13px; color:var(--text-secondary); }

.toast { position:fixed; top:20px; right:20px; padding:12px 20px; border-radius:8px; color:#fff; font-size:14px; z-index:2600; transform:translateX(120%); transition:transform 0.3s; }
.toast.show { transform:translateX(0); }
.toast-success { background:var(--success); }
.toast-error { background:var(--danger); }

.empty-state { text-align:center; padding:40px; color:var(--text-secondary); }
.empty-state .icon { font-size:48px; margin-bottom:12px; }

/* 生产看板 */
.kanban-board { display:grid; grid-template-columns:repeat(auto-fit, minmax(300px, 1fr)); gap:16px; }
.kanban-col { background:#f8f9fa; border-radius:10px; padding:12px; min-height:200px; }
.kanban-col h3 { font-size:14px; margin-bottom:12px; color:var(--text-secondary); text-align:center; }
.kanban-card { background:#fff; border-radius:8px; padding:12px; margin-bottom:8px; box-shadow:0 1px 2px rgba(0,0,0,0.06); font-size:13px; cursor:pointer; transition:all 0.2s; }
.kanban-card:hover { box-shadow:0 2px 8px rgba(0,0,0,0.12); }

@media (max-width:768px) {
  .sidebar { width:60px; }
  .sidebar-logo { font-size:0; padding:12px; }
  .sidebar-logo::after { content:'MES'; font-size:14px; }
  .sidebar-menu a span:not(.icon) { display:none; }
  .sidebar-menu .menu-group { display:none; }
  .main-content { margin-left:60px; }
  .form-row { grid-template-columns:1fr; }
}

	/* ============================================
	   UI 增强
	   ============================================ */
	::-webkit-scrollbar { width:6px; height:6px; }
	::-webkit-scrollbar-track { background:transparent; }
	::-webkit-scrollbar-thumb { background:#c1c1c1; border-radius:3px; }
	::-webkit-scrollbar-thumb:hover { background:#a1a1a1; }

	.sidebar { box-shadow:2px 0 12px rgba(0,0,0,0.08); }
	.sidebar-logo { background:linear-gradient(135deg,#1a73e8,#0d47a1); letter-spacing:1px; }
	.sidebar-menu a { margin:2px 8px; border-radius:8px; border-left:none !important; }
	.sidebar-menu a:hover, .sidebar-menu a.active { background:rgba(255,255,255,0.12); }

	.header { box-shadow:0 1px 4px rgba(0,0,0,0.06); }
	.header button { transition:all 0.15s; }
	.header button:hover { background:#e8f0fe; border-color:var(--primary); }

	.card { border:1px solid var(--border); transition:box-shadow 0.2s; }
	.card:hover { box-shadow:0 2px 8px rgba(0,0,0,0.1); }
	.card-header { background:#fafbfc; border-radius:10px 10px 0 0; }

	.stat-card { border:1px solid var(--border); transition:all 0.2s; cursor:default; }
	.stat-card:hover { box-shadow:0 4px 12px rgba(0,0,0,0.1); transform:translateY(-1px); }
	.stat-card .stat-value { background:linear-gradient(135deg,#1a73e8,#4a90d9); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }

	th { background:linear-gradient(to bottom,#f8f9fa,#f0f1f3); font-size:12px; text-transform:uppercase; letter-spacing:0.5px; color:#555; }
	td { vertical-align:middle; }
	tr:hover td { background:#f0f4ff; }

	.btn { letter-spacing:0.3px; }
	.btn:active { transform:scale(0.97); }
	.btn-outline:hover { background:#e8f0fe; border-color:var(--primary-dark); color:var(--primary-dark); }
	.btn-sm { padding:5px 12px; border-radius:4px; }

	.badge { letter-spacing:0.3px; }

	.search-bar input, .search-bar select { transition:border-color 0.15s,box-shadow 0.15s; }
	.search-bar input:focus, .search-bar select:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(26,115,232,0.1); }

	.modal { animation:slideUp 0.2s ease; }
	@keyframes slideUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }

	.pagination button { transition:all 0.15s; }
	.pagination button:hover:not(:disabled) { background:var(--primary); color:#fff; border-color:var(--primary); }

	@media (max-width:768px) {
	  .stats-row { grid-template-columns:repeat(2,1fr); }
	  .kanban-board { grid-template-columns:1fr; }
	}

	/* Column resize */
	th.resizable { position:relative; }
	th .resize-handle { position:absolute; right:0; top:0; bottom:0; width:5px; cursor:col-resize; user-select:none; z-index:1; }
	th .resize-handle:hover, th .resize-handle.active { background:var(--primary); }
	.col-resize-overlay { position:fixed; top:0;left:0;right:0;bottom:0;z-index:9999;cursor:col-resize;display:none; }
	.col-resize-overlay.active { display:block; }

	/* Column reorder */
	.col-sort-item { cursor:grab; padding:3px 0; }
	.col-sort-item:active { cursor:grabbing; }
	.col-sort-item.drag-over { border-top:2px solid var(--primary); }

/* ============================================
   UI 增强：加载动画、过渡、条纹
   ============================================ */

/* 页面切换过渡 */
.page { animation: fadeSlideIn 0.2s ease; }
@keyframes fadeSlideIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* 表格斑马纹 */
tbody tr:nth-child(even) td { background:rgba(0,0,0,0.015); }
tbody tr:hover td { background:#f0f4ff !important; }

/* 按钮 loading 状态 */
.btn.loading { pointer-events:none; opacity:0.7; position:relative; color:transparent !important; }
.btn.loading::after { content:''; position:absolute; top:50%;left:50%;width:16px;height:16px;margin:-8px 0 0 -8px;border:2px solid transparent;border-top-color:currentColor;border-radius:50%;animation:spin 0.6s linear infinite; color:inherit; }
@keyframes spin { to { transform:rotate(360deg); } }
.spin-dot { display:inline-block;width:16px;height:16px;border:2px solid #ddd;border-top-color:#1890ff;border-radius:50%;animation:spin 0.6s linear infinite;vertical-align:middle;margin-right:6px; }

/* 全局加载遮罩 */
.page-loader { display:flex; justify-content:center; align-items:center; padding:60px 20px; color:var(--text-secondary); flex-direction:column; gap:12px; }
.page-loader .spinner { width:36px; height:36px; border:3px solid #e0e0e0; border-top-color:var(--primary); border-radius:50%; animation:spin 0.7s linear infinite; }
.page-loader .text { font-size:13px; }
.page-loader--workspace { display:block; min-height:calc(100vh - 120px); padding:24px; }
.page-loader--workspace .page-loader-heading { display:flex; flex-direction:column; gap:10px; width:min(520px,70%); margin-bottom:22px; }
.page-loader--workspace .page-loader-line { display:block; height:18px; width:100%; border-radius:4px; background:linear-gradient(90deg,#e8efeb 25%,#f5f8f6 37%,#e8efeb 63%); background-size:400% 100%; animation:page-loader-shimmer 1.4s ease infinite; }
.page-loader--workspace .page-loader-line--short { width:42%; height:12px; }
.page-loader--workspace .page-loader-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:18px; }
.page-loader--workspace .page-loader-metrics span { display:block; height:74px; border:1px solid #e4ebe7; border-radius:6px; background:linear-gradient(90deg,#f0f4f2 25%,#fafcfb 37%,#f0f4f2 63%); background-size:400% 100%; animation:page-loader-shimmer 1.4s ease infinite; }
.page-loader--workspace .page-loader-body { display:flex; flex-direction:column; gap:9px; padding:14px; border:1px solid #e4ebe7; border-radius:6px; background:#fff; }
.page-loader--workspace .page-loader-body span { display:block; height:34px; border-radius:3px; background:linear-gradient(90deg,#f0f4f2 25%,#fafcfb 37%,#f0f4f2 63%); background-size:400% 100%; animation:page-loader-shimmer 1.4s ease infinite; }
.page-loader--workspace .spinner { margin:18px auto 8px; }
.page-loader--workspace .text { text-align:center; color:var(--text-secondary); }
@keyframes page-loader-shimmer { 0% { background-position:100% 0; } 100% { background-position:-100% 0; } }
@media (max-width:700px) { .page-loader--workspace { padding:14px; } .page-loader--workspace .page-loader-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); } }

/* 表格内行加载占位 */
.skeleton-row td { height:36px; background:linear-gradient(90deg,#f0f0f0 25%,#e8e8e8 50%,#f0f0f0 75%); background-size:200% 100%; animation:shimmer 1.5s ease-in-out infinite; }
@keyframes shimmer { 0% { background-position:200% 0; } 100% { background-position:-200% 0; } }

/* 空状态增强 */
.empty-state { text-align:center; padding:48px 20px; color:#aaa; }
.empty-state .icon { font-size:52px; margin-bottom:16px; opacity:0.6; }

/* 数字动画 */
.stat-card .stat-value { transition:all 0.3s ease; }

/* Toast 增强 */
.toast { box-shadow:0 4px 16px rgba(0,0,0,0.15); font-weight:500; }

/* ============================================
   可折叠卡片
   ============================================ */
.card-header { cursor:pointer; user-select:none; }
.card-header::before {
  content:'▾';
  display:inline-block;
  margin-right:8px;
  font-size:12px;
  transition:transform 0.2s;
  opacity:0.4;
  flex-shrink:0;
}
.card.collapsed .card-header::before { transform:rotate(-90deg); }
.card.collapsed .card-body { display:none; }

/* ============================================
   生产控制台视觉改版
   ============================================ */
:root {
  --primary: #157f6d;
  --primary-dark: #0d5d51;
  --primary-soft: #e1f1eb;
  --success: #23865f;
  --success-soft: #e3f3e9;
  --warning: #b97119;
  --warning-soft: #fff1db;
  --danger: #c84343;
  --danger-soft: #fbe9e7;
  --info: #2d6e9d;
  --info-soft: #e4f0f7;
  --bg: #edf1ef;
  --card: #ffffff;
  --border: #dce5e0;
  --text: #172b27;
  --text-secondary: #63736e;
  --sidebar-width: 180px;
  --header-height: 64px;
  --shadow-sm: 0 1px 2px rgba(15, 38, 32, .05), 0 2px 8px rgba(15, 38, 32, .04);
  --shadow-md: 0 12px 28px rgba(15, 38, 32, .09);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(21, 127, 109, .25);
  outline-offset: 2px;
}

/* 登录 */
.login-container {
  position: relative;
  overflow: hidden;
  background: #102622;
  padding: 24px;
}
.login-container::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, #000, transparent);
}
.login-box {
  position: relative;
  width: min(100%, 408px);
  padding: 38px 36px 34px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.login-box h1 { color: var(--text); font-size: 24px; letter-spacing: 0; }
.login-box h1::before { content: "筑"; display: block; width: 42px; height: 42px; margin: 0 auto 14px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 20px; line-height: 42px; }
.login-box .subtitle { color: var(--text-secondary); margin-bottom: 26px; }
.login-box label { color: #40524c; font-weight: 700; }
.login-box input { border-color: #cfdad5; border-radius: 5px; padding: 11px 12px; margin-bottom: 18px; }
.login-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(21,127,109,.14); }
.login-box button { border-radius: 5px; background: var(--primary); font-weight: 700; letter-spacing: 1px; }
.login-box button:hover { background: var(--primary-dark); }

/* 应用外壳 */
.sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #152b27;
  border-right: 1px solid rgba(255,255,255,.07);
  box-shadow: 4px 0 16px rgba(12, 34, 28, .12);
  scrollbar-color: rgba(255,255,255,.18) transparent;
}
.sidebar-logo {
  min-height: 76px;
  padding: 14px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #10231f;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-align: left;
}
.brand-lockup { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 31px;
  width: 31px;
  height: 31px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
}
.brand-name { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 0; white-space: nowrap; }
.sidebar-toggle {
  width: 25px;
  height: 25px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 5px;
  background: transparent;
  color: rgba(255,255,255,.88);
  cursor: pointer;
  font-size: 12px;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.10); }
.sidebar.is-collapsed {
  width: 56px;
  overflow-x: hidden;
}
.main-content.is-sidebar-collapsed { margin-left: 56px; }
.sidebar.is-collapsed .sidebar-logo {
  min-height: 84px;
  padding: 9px 6px 8px;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.sidebar.is-collapsed .brand-lockup { gap: 0; }
.sidebar.is-collapsed .brand-mark {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  font-size: 15px;
}
.sidebar.is-collapsed .brand-name,
.sidebar.is-collapsed .sidebar-menu .menu-group,
.sidebar.is-collapsed .sidebar-menu a span:not(.icon) { display: none; }
.sidebar.is-collapsed .sidebar-toggle {
  width: 26px;
  height: 24px;
  flex: 0 0 24px;
}
.sidebar.is-collapsed .sidebar-menu { padding: 8px 7px 24px; }
.sidebar.is-collapsed .sidebar-menu a {
  justify-content: center;
  margin: 2px 0;
  padding: 8px 5px;
}
.sidebar.is-collapsed .sidebar-menu a.active::before { left: -7px; }
.sidebar-menu {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px 7px 24px;
  overflow-y: auto;
}
.sidebar-menu .menu-group {
  padding: 14px 8px 6px;
  color: #8ba19a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.1px;
}
.sidebar-menu a {
  position: relative;
  min-height: 37px;
  margin: 2px 0;
  padding: 8px 8px;
  border-radius: 5px;
  border-left: 0 !important;
  color: #bed0c8;
  font-size: 13px;
}
.sidebar-menu a .icon {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 24px;
  border-radius: 4px;
  background: rgba(255,255,255,.055);
  font-size: 14px;
}
.sidebar-menu a:hover { color: #fff; background: rgba(255,255,255,.075); }
.sidebar-menu a.active { color: #fff; background: rgba(34, 159, 133, .25); }
.sidebar-menu a.active::before { content: ""; position: absolute; left: -10px; width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: #4dd5b1; }
.sidebar-menu a.active .icon { background: rgba(77,213,177,.18); }

.main-content { background: var(--bg); }
.header {
  height: var(--header-height);
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(16, 45, 37, .02);
}
.header-title { display: flex; align-items: center; gap: 11px; color: var(--text); font-size: 18px; font-weight: 800; }
.header-rail { width: 4px; height: 27px; border-radius: 2px; background: var(--primary); box-shadow: 8px 0 0 var(--primary-soft); }
.header .user-info { gap: 10px; color: #53655f; }
.header .user-info .role-badge { padding: 4px 9px; border-radius: 4px; background: var(--primary-soft); color: var(--primary-dark); font-size: 12px; font-weight: 700; }
.header button { padding: 6px 10px; border: 1px solid #d4dfda; border-radius: 4px; color: #5a6964; }
.header button:hover { background: #f2f7f4; border-color: #acc8bc; color: var(--primary-dark); }

.page { max-width: 1640px; padding: 26px 28px 40px; }

/* 信息组件 */
.card {
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: var(--shadow-sm);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
  min-height: 52px;
  padding: 14px 18px;
  border-bottom-color: var(--border);
  border-radius: 0;
  background: #fbfcfb;
  color: #263e37;
  font-size: 15px;
  font-weight: 800;
}
.card-header::before { color: var(--primary); opacity: .7; }
.card-body { padding: 18px; }

/* 筑木对接页使用与新工作台一致的无图标紧凑卡片。 */
.zhumu-page { max-width: 1640px; }
.zhumu-page .card-header::before { display: none; }
.zhumu-page .card-header { min-height: 48px; padding: 12px 16px; }
.zhumu-page .card-body { padding: 16px; }
.zhumu-page .zhumu-sync-card { border-color: var(--border); }
.zhumu-page .zhumu-sync-card .card-header { background: #fbfcfb; }
.zhumu-page .btn { border-radius: 5px; box-shadow: none; }
.zhumu-page .badge { border-radius: 4px; }
.zhumu-sync-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}
.zhumu-sync-title { display: grid; gap: 2px; min-width: 220px; margin-right: auto; }
.zhumu-sync-title b { color: #203a32; font-size: 15px; }
.zhumu-sync-title span { color: var(--text-secondary); font-size: 12px; }
.zhumu-sync-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: #40554e;
  cursor: pointer;
  user-select: none;
}
.zhumu-sync-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.zhumu-sync-switch > span {
  position: relative;
  width: 38px;
  height: 20px;
  border: 1px solid #aebcb6;
  border-radius: 10px;
  background: #dfe5e2;
  transition: background .16s ease, border-color .16s ease;
}
.zhumu-sync-switch > span::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20,45,37,.2);
  transition: transform .16s ease;
}
.zhumu-sync-switch input:checked + span { border-color: var(--primary); background: var(--primary); }
.zhumu-sync-switch input:checked + span::after { transform: translateX(18px); }
.zhumu-sync-switch input:focus-visible + span { outline: 3px solid rgba(21,127,109,.22); outline-offset: 2px; }
.zhumu-sync-switch input:disabled + span { opacity: .5; cursor: not-allowed; }
.zhumu-sync-switch b { font-size: 12px; }
.zhumu-sync-now { min-width: 92px; justify-content: center; }
.zhumu-sync-path {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
  border: 1px solid #d8e3de;
  background: #f5f8f6;
}
.zhumu-sync-path span { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 8px 12px; border-right: 1px solid #d8e3de; }
.zhumu-sync-path span:last-child { border-right: 0; }
.zhumu-sync-path b { color: #40554e; font-size: 12px; }
.zhumu-sync-path em { color: var(--primary-dark); font-size: 12px; font-style: normal; font-weight: 800; }
.zhumu-sync-summary { display: flex; flex-wrap: wrap; gap: 7px 20px; min-height: 35px; padding: 10px 1px 0; color: #60726b; font-size: 12px; }
.zhumu-sync-summary span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.zhumu-sync-summary b { color: #314a42; }
.zhumu-sync-progress { margin-top: 10px; padding: 11px 12px; border: 1px solid #bad6ca; background: #edf7f2; }
.zhumu-sync-progress[hidden] { display: none; }
.zhumu-sync-progress-head { display: flex; justify-content: space-between; margin-bottom: 7px; color: #285747; font-size: 12px; }
.zhumu-sync-progress-track { height: 7px; overflow: hidden; background: #d2e3dc; }
.zhumu-sync-progress-track span { display: block; height: 100%; background: var(--primary); transition: width .2s ease; }
.zhumu-sync-progress-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: #4f655d; font-size: 11px; }
.zhumu-sync-current { margin-top: 5px; color: #6b7b75; font-size: 11px; }
.zhumu-sync-result > div { margin-top: 10px; padding: 9px 11px; border: 1px solid; font-size: 12px; }
.zhumu-sync-result--working { border-color: #bfd2df !important; background: #edf4f8; color: #315f7c; }
.zhumu-sync-result--success { border-color: #b9d8c9 !important; background: #edf7f1; color: #176444; }
.zhumu-sync-result--error { border-color: #e5c0bc !important; background: #fdf0ee; color: #a23732; }
.modal:has(.zhumu-sync-time-dialog) { width: min(500px, calc(100vw - 28px)); max-width: 500px; }
.zhumu-sync-time-dialog { display: grid; gap: 16px; }
.zhumu-sync-time-lead { padding: 10px 12px; border-left: 3px solid var(--primary); background: #f0f7f4; color: #3e5b50; font-size: 12px; line-height: 1.65; }
.zhumu-sync-time-dialog .form-group { margin: 0; }
.zhumu-sync-time-dialog .form-group label { display: block; margin-bottom: 7px; color: #344f44; font-size: 12px; font-weight: 800; }
.zhumu-sync-time-dialog input[type="datetime-local"] { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #c6d4ce; border-radius: 5px; background: #fff; color: #203a30; font: inherit; font-size: 13px; }
.zhumu-sync-time-dialog input[type="datetime-local"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(21,127,109,.13); outline: none; }
.zhumu-sync-time-hint { margin-top: 7px; color: #718079; font-size: 11px; }
.zhumu-sync-more { display: flex; align-items: center; gap: 18px; margin-top: 12px; padding: 11px 12px; border-top: 1px solid #dde6e1; background: #fafbfa; }
.zhumu-sync-more[hidden] { display: none; }
.zhumu-sync-more > div { display: grid; gap: 2px; margin-right: auto; }
.zhumu-sync-more b { color: #3b5049; font-size: 12px; }
.zhumu-sync-more span { color: #718079; font-size: 11px; }
@media (max-width: 760px) {
  .zhumu-sync-toolbar { align-items: stretch; flex-wrap: wrap; }
  .zhumu-sync-title { flex: 1 0 100%; }
  .zhumu-sync-path { grid-template-columns: 1fr; }
  .zhumu-sync-path span { border-right: 0; border-bottom: 1px solid #d8e3de; }
  .zhumu-sync-path span:last-child { border-bottom: 0; }
  .zhumu-sync-more { align-items: stretch; flex-direction: column; }
  .zhumu-sync-more .btn { width: 100%; justify-content: center; }
}
.stats-row { gap: 14px; margin-bottom: 18px; }
.stat-card {
  position: relative;
  min-height: 116px;
  padding: 19px 20px 17px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: var(--shadow-sm);
  background: var(--card);
}
.stat-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--primary); }
.stat-card:nth-child(2)::before { background: var(--warning); }
.stat-card:nth-child(3)::before { background: var(--success); }
.stat-card:nth-child(4)::before { background: var(--danger); }
.stat-card:hover { transform: none; box-shadow: var(--shadow-md); }
.stat-card .stat-value {
  color: var(--text) !important;
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: currentColor;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 31px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
}
.stat-card .stat-label { margin-top: 9px; color: var(--text-secondary); font-size: 13px; font-weight: 600; }

table { font-size: 13px; }
th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #f4f7f5;
  color: #53655f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}
.field-header-label {
  min-width: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  line-height: 1.15;
  vertical-align: middle;
}
.field-header-original {
  color: #3d514a;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.field-header-note {
  color: #76867f;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.field-header-sort { margin-left: 4px; color: var(--primary); }
td { padding: 11px 12px; border-bottom-color: #e7eeea; color: #334841; }
tbody tr:nth-child(even) td { background: #fbfcfb; }
tbody tr:hover td, tr:hover td { background: #edf7f2 !important; }
.table-scroll { border-color: var(--border); border-radius: 5px; }

.btn {
  min-height: 34px;
  padding: 7px 13px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: none;
}
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); }
.btn-danger { background: var(--danger); }
.btn-outline { border-color: #9db8ad; color: var(--primary-dark); background: #fff; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); }
.btn-sm { min-height: 28px; padding: 4px 9px; font-size: 12px; }

.badge { padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0; }
.badge-success { background: var(--success-soft); color: #176946; }
.badge-warning { background: var(--warning-soft); color: #965d11; }
.badge-danger { background: var(--danger-soft); color: #a43232; }
.badge-info { background: var(--info-soft); color: #235b84; }
.badge-default { background: #edf0ee; color: #64736e; }

.search-bar { gap: 9px; margin-bottom: 15px; }
.search-bar input, .search-bar select, .form-group input, .form-group select, .form-group textarea {
  min-height: 36px;
  padding: 7px 10px;
  border-color: #cad7d1;
  border-radius: 4px;
  color: var(--text);
  background: #fff;
}
.search-bar input:focus, .search-bar select:focus, .form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(21,127,109,.13); }
.form-group label { color: #43564f; font-weight: 700; }

.modal-overlay { background: rgba(10, 27, 22, .52); backdrop-filter: blur(2px); }
.modal { border-radius: 8px; box-shadow: 0 24px 65px rgba(0,0,0,.24); }
.modal-header { padding: 16px 20px; background: #f7faf8; border-bottom-color: var(--border); color: #233b34; font-weight: 800; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; background: #fbfcfb; border-top-color: var(--border); }
.modal-header .close-btn { color: #63736e; }

.kanban-board { gap: 14px; }
.kanban-col { padding: 12px; border: 1px solid var(--border); border-radius: 7px; background: #e7eeea; }
.kanban-col h3 { color: #426057; font-weight: 800; }
.kanban-card { border: 1px solid #e0e9e4; border-radius: 5px; box-shadow: 0 1px 2px rgba(15,38,32,.05); }
.kanban-card:hover { border-color: #a8cabc; box-shadow: var(--shadow-sm); }
.empty-state { color: #7a8a84; }

.toast { top: 18px; right: 22px; border-radius: 5px; box-shadow: var(--shadow-md); }

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-logo { min-height: 64px; padding: 12px; justify-content: center; }
  .brand-name, .sidebar-toggle { display: none !important; }
  .brand-mark { width: 30px; height: 30px; flex-basis: 30px; font-size: 15px; }
  .sidebar-menu { padding: 10px 8px; }
  .sidebar-menu a { justify-content: center; padding: 8px; }
  .sidebar-menu a .icon { width: 28px; }
  .sidebar-menu a.active::before { left: -8px; }
  .main-content { margin-left: 60px; }
  .header { height: 56px; padding: 0 16px; }
  .header-title { font-size: 16px; }
  .header-rail { height: 23px; }
  .header .user-info > span:first-child { display: none; }
  .page { padding: 16px; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { min-height: 100px; padding: 16px 14px; }
  .stat-card .stat-value { font-size: 26px; }
  .card-body { padding: 14px; }
}

@media (max-width: 460px) {
  .header .user-info .role-badge { display: none; }
  .stats-row { grid-template-columns: 1fr; }
  .card-header { padding: 13px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ============================================
   独立表格视口：双向滚动 + 锁定表头
   ============================================ */
.card-header {
  justify-content: flex-start;
  gap: 8px;
}
.card-header > button:last-child:not(:first-child),
.card-header > div:last-child:not(:first-child) { margin-left: auto; }

.table-scroll {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: 420px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(23,43,39,.025);
}
.table-scroll--large { max-height: min(58vh, 620px); }
.table-scroll--compact { max-height: min(42vh, 420px); }
.table-scroll:focus-visible {
  outline: 3px solid rgba(21,127,109,.20);
  outline-offset: 2px;
}
.table-scroll table {
  width: max-content;
  min-width: 100%;
  margin: 0;
}
.table-scroll thead th {
  position: sticky !important;
  top: 0;
  z-index: 8;
  background: #edf3f0;
  box-shadow: inset 0 -1px 0 #cbd9d3, 0 2px 5px rgba(20,54,44,.07);
}
.table-scroll .col-resize-handle { z-index: 10; }
.table-scroll::-webkit-scrollbar { width: 11px; height: 11px; }
.table-scroll::-webkit-scrollbar-track { background: #edf2ef; }
.table-scroll::-webkit-scrollbar-thumb {
  border: 2px solid #edf2ef;
  border-radius: 6px;
  background: #9fb5ac;
}
.table-scroll::-webkit-scrollbar-thumb:hover { background: #6f9185; }
.table-scroll::-webkit-scrollbar-corner { background: #edf2ef; }

@media (max-width: 768px) {
  .table-scroll--large { max-height: 62vh; }
  .table-scroll--compact { max-height: 46vh; }
}

/* 分拣工作区 */
.sorting-page {
  width: 100%;
  height: calc(100vh - var(--header-height));
  max-width: none;
  min-width: 0;
  display: flex;
  gap: 8px;
  padding: 10px 12px 8px 8px;
  overflow-x: hidden;
}
.page.active.sorting-page { display: flex; }
.main-content.is-sorting-page > .header { display: none; }
.main-content.is-sorting-page,
.main-content.is-sorting-page #pageContainer {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.main-content.is-sorting-page .sorting-page { height: 100%; min-height: 0; }
.sorting-workspace {
  position: relative;
  min-width: 0;
  overflow-y: hidden !important;
}
.sorting-reminder-banner {
  position: absolute;
  top: 4px;
  left: 8px;
  right: 8px;
  z-index: 80;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease;
}
.sorting-reminder-banner[hidden] { display: none; }
.sorting-reminder-banner.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.sorting-reminder-banner-content {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 6px 18px;
  border: 2px solid #e2a821;
  border-left-width: 8px;
  border-radius: 6px;
  background: #fff4c7;
  color: #5c3a00;
  box-shadow: 0 5px 16px rgba(77,53,4,.24);
  box-sizing: border-box;
}
.sorting-reminder-banner-label {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 3px;
  background: #9b6200;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.sorting-reminder-banner strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #382300;
  font-size: 26px;
  line-height: 1.25;
  text-align: center;
}
.sorting-workspace > #sortingCurrentOrder,
.sorting-workspace > #sortingGrid,
.sorting-workspace > #sortingPreview,
.sorting-workspace > #sortingLocDetail {
  flex-shrink: 0;
}
.sorting-left-panel {
  width: 188px;
  flex: 0 0 188px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
  border: 1px solid #d6e0dc;
  border-radius: 8px;
  background: #fff;
  transition: width .25s ease, flex-basis .25s ease, padding .25s ease;
}
.sorting-left-header {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #1a73e8;
}
.sorting-panel-toggle {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #4f625b;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}
.sorting-panel-toggle:hover,
.sorting-panel-toggle:focus-visible {
  border-color: #b9d2c8;
  outline: none;
  background: #edf7f3;
  color: #176946;
}
.sorting-left-panel.is-collapsed {
  width: 28px;
  flex: 0 0 28px;
  padding: 8px 4px;
  overflow: hidden;
  cursor: pointer;
}
.sorting-left-panel.is-collapsed:hover { border-color: #8cbcac; background: #f4faf7; }
.sorting-left-panel.is-collapsed .sorting-panel-toggle { width: 22px; height: 26px; flex-basis: 22px; }
.sorting-left-panel.is-collapsed .sorting-left-header {
  justify-content: center;
  margin: 0;
  padding: 0;
  border-bottom: 0;
}
.sorting-left-panel.is-collapsed .sorting-left-header > span,
.sorting-left-panel.is-collapsed #sortingOrderList,
.sorting-left-panel.is-collapsed #sortingScanLog {
  display: none;
}
.sorting-left-panel #sortingOrderList {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 3px;
}
.sorting-order-card {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.sorting-order-card > div:not(:last-child) { white-space: normal; }
.sorting-completed-search {
  width: 100%;
  height: 30px;
  margin: 1px 0 7px;
  padding: 3px 8px;
  border: 1px solid #b9d5c7;
  border-radius: 4px;
  outline: none;
  background: #fff;
  color: #2f433c;
  font-size: 10px;
}
.sorting-completed-search:focus {
  border-color: #23865d;
  box-shadow: 0 0 0 2px rgba(35,134,93,.12);
}
.sorting-completed-empty {
  padding: 12px 4px;
  color: #7a8984;
  font-size: 11px;
  text-align: center;
}
.sorting-side-scan-log {
  flex: 0 0 auto;
  max-height: 190px;
  margin-top: 10px;
  padding-top: 10px;
  overflow: hidden;
  border-top: 1px solid #dbe5e1;
}
.sorting-side-scan-header {
  cursor: pointer;
  user-select: none;
  color: #2f493f;
  font-size: 13px;
  font-weight: 700;
}
.sorting-side-scan-header span { margin-left: 3px; color: #81918b; font-size: 11px; }
.sorting-side-scan-list {
  max-height: 145px;
  margin-top: 8px;
  overflow-y: auto;
  color: #71817c;
  font-size: 11px;
  line-height: 1.55;
}

#sortingGrid {
  display: grid !important;
  grid-template-columns: repeat(var(--sorting-location-count, 1), minmax(0, 1fr));
  position: sticky;
  top: 56px;
  z-index: 18;
  min-height: 76px;
  padding-bottom: 7px !important;
  background: var(--bg);
  box-shadow: 0 -12px 0 var(--bg);
  overflow-x: hidden !important;
}
.sorting-grid-empty {
  grid-column: 1 / -1;
  width: 100%;
  padding: 28px 12px;
  color: #7b8984;
  text-align: center;
}
.sorting-workspace > #sortingCurrentOrder {
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 3px 9px rgba(31, 65, 54, .12);
}
.sorting-location-card {
  height: 72px;
  min-width: 0;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 10px;
  border: 2px solid #cbd6d2;
  border-radius: 7px;
  box-sizing: border-box;
  text-align: center;
  cursor: pointer;
  background: #f7faf9;
  transition: box-shadow .2s ease, transform .2s ease, filter .2s ease;
}
.sorting-location-card.is-unstarted { border-color: #cbd6d2; background: #f7faf9; }
.sorting-location-card.is-progress { border-color: #e1a23d; background: #fff4df; }
.sorting-location-card.is-complete { border-color: #2f9b6c; background: #e8f5ee; }
.sorting-location-card.is-selected { transform: none; }
#sortingGrid.is-dense { gap: 7px !important; }
#sortingGrid.is-dense .sorting-location-card {
  padding-inline: 5px;
}
#sortingGrid.is-dense .sorting-location-card-title { font-size: 18px; }
#sortingGrid.is-dense .sorting-location-card-name { font-size: 10px; }
#sortingGrid.is-dense .sorting-location-card-count { font-size: 9px; }
#sortingGrid.is-very-dense { gap: 4px !important; }
#sortingGrid.is-very-dense .sorting-location-card {
  height: 66px;
  padding-inline: 3px;
}
#sortingGrid.is-very-dense .sorting-location-card-title { font-size: 15px; }
#sortingGrid.is-very-dense .sorting-location-card-name { font-size: 9px; }
.sorting-location-card:hover {
  filter: brightness(.98);
  box-shadow: 0 3px 10px rgba(31, 65, 54, .14);
}
.sorting-location-card.is-selected {
  outline: 3px solid #1a73e8;
  outline-offset: -1px;
  box-shadow: 0 4px 12px rgba(26,115,232,.24);
}
.sorting-location-card-title {
  color: #42645a;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
}
.sorting-location-card.is-progress .sorting-location-card-title { color: #a25e00; }
.sorting-location-card.is-complete .sorting-location-card-title { color: #19754f; }
.sorting-location-card-name {
  margin: 1px 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sorting-location-card-count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0 4px;
  flex-wrap: wrap;
  color: #66736e;
  font-size: 10px;
  line-height: 1.05;
}
.sorting-location-card-count > span { white-space: nowrap; }
.sorting-location-card-count > .sorting-location-match { color: #0f6b59; font-weight: 800; }
.sorting-location-card-progress {
  height: 4px;
  margin-top: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: #dce4e0;
}
.sorting-location-card-progress > div {
  height: 100%;
  border-radius: inherit;
  background: #aab8b3;
}
.sorting-location-card.is-progress .sorting-location-card-progress > div { background: #df8b14; }
.sorting-location-card.is-complete .sorting-location-card-progress > div { background: #23865d; }
.sorting-location-card.is-scan-flashing {
  position: relative;
  z-index: 19;
  animation: sorting-location-flash .6s ease-in-out 4;
}
.sorting-location-card.is-scan-flashing .sorting-location-card-title {
  animation: sorting-location-title-flash .6s ease-in-out 4;
}
@keyframes sorting-location-flash {
  0%,100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 4px var(--sorting-flash-color, #0d904f), 0 0 22px var(--sorting-flash-color, #0d904f); }
}
@keyframes sorting-location-title-flash {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.2); color: var(--sorting-flash-color, #0d904f); }
}
@media (prefers-reduced-motion: reduce) {
  .sorting-location-card.is-scan-flashing,
  .sorting-location-card.is-scan-flashing .sorting-location-card-title { animation-iteration-count: 1; }
}

.sorting-location-detail:empty { display: none; }
.sorting-workspace > .sorting-location-detail:not(:empty) {
  min-height: 120px;
  flex: 1 1 0;
}
.sorting-location-detail-panel {
  position: relative;
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 8px;
  border: 1px solid #cddbd5;
  border-radius: 7px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.sorting-location-detail-toolbar {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}
.sorting-location-detail-toolbar .btn {
  min-height: 28px;
  padding: 3px 9px;
}
.sorting-column-panel {
  position: fixed;
  top: max(8px, calc(var(--header-height, 56px) + 8px));
  right: 8px;
  z-index: 180;
  width: min(288px, calc(100% - 16px));
  max-height: min(560px, calc(100dvh - 16px));
  display: flex;
  flex-direction: column;
  padding: 10px;
  overflow: hidden;
  border: 1px solid #bfcfc8;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(20,54,44,.2);
}
.sorting-column-panel[hidden] { display: none; }
.sorting-column-panel-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
  color: #2f493f;
  font-size: 13px;
}
.sorting-column-panel-head span { color: #74857e; font-size: 11px; }
.sorting-column-panel-close {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: inline-grid;
  place-items: center;
  margin-left: auto;
  padding: 0;
  border: 1px solid #c8d5d0;
  border-radius: 4px;
  background: #fff;
  color: #53645c;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}
.sorting-column-panel-close:hover,
.sorting-column-panel-close:focus-visible { border-color: #79a897; background: #edf7f3; color: #0f6b59; outline: none; }
.sorting-column-actions { display: flex; gap: 6px; margin-bottom: 7px; }
.sorting-column-actions button {
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid #c8d5d0;
  border-radius: 4px;
  background: #f7faf9;
  color: #375249;
  cursor: pointer;
  font-size: 11px;
}
.sorting-column-actions button:hover { border-color: #76a897; background: #eef7f3; }
.sorting-column-search {
  width: 100%;
  height: 28px;
  margin-bottom: 7px;
  padding: 3px 8px;
  border: 1px solid #c8d5d0;
  border-radius: 4px;
  outline: none;
  font-size: 12px;
}
.sorting-column-search:focus { border-color: #1a73e8; box-shadow: 0 0 0 2px rgba(26,115,232,.12); }
.sorting-column-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(min(560px, calc(100dvh - 16px)) - 112px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #d9e2de;
  border-radius: 4px;
  background: #fff;
}
.sorting-column-item {
  position: relative;
  min-height: 29px;
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  align-items: center;
  gap: 1px;
  padding: 0 5px 0 2px;
  border-bottom: 1px solid #e7eeea;
  background: #fff;
}
.sorting-column-item:last-child { border-bottom: 0; }
.sorting-column-item:hover { background: #f4f8f6; }
.sorting-column-item.is-dragging { opacity: .42; background: #eaf3ef; }
.sorting-column-item.drop-before::before,
.sorting-column-item.drop-after::after {
  content: '';
  position: absolute;
  z-index: 2;
  right: 3px;
  left: 3px;
  height: 2px;
  border-radius: 2px;
  background: #1683d8;
  pointer-events: none;
}
.sorting-column-item.drop-before::before { top: -1px; }
.sorting-column-item.drop-after::after { bottom: -1px; }
.sorting-column-drag {
  width: 24px;
  height: 27px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #8b9a94;
  cursor: grab;
}
.sorting-column-drag:active { cursor: grabbing; }
.sorting-column-drag:focus-visible { outline: 2px solid #1683d8; outline-offset: -3px; }
.sorting-column-drag span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 6px 0 currentColor, 0 5px currentColor, 6px 5px currentColor, 0 10px currentColor, 6px 10px currentColor;
  transform: translate(-3px, -5px);
}
.sorting-column-item label {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: #263c34;
  font-size: 13px;
  line-height: 1.2;
}
.sorting-column-item label input { width: 14px; height: 14px; margin: 0; accent-color: #1683d8; }
.sorting-column-item label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sorting-location-search {
  width: clamp(180px, 18vw, 260px);
  height: 28px;
  padding: 3px 9px;
  border: 1px solid #c8d5d0;
  border-radius: 4px;
  outline: none;
  background: #fff;
  color: #2f433c;
  font-size: 12px;
}
.sorting-location-search:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26,115,232,.12);
}
.sorting-location-table {
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  flex: 1 1 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.sorting-location-table th,
.sorting-location-table td {
  padding: 4px 8px;
  line-height: 1.2;
}
.sorting-location-table .badge {
  padding: 1px 6px;
  line-height: 1.2;
}
.sorting-location-table .sorting-data-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sorting-table-sort {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  white-space: nowrap;
}
.sorting-table-sort:hover,
.sorting-table-sort:focus-visible { color: #1a73e8; outline: none; }
.sorting-location-table .sorting-search-empty > td {
  height: 72px;
  background: #f7faf9 !important;
  color: #778780;
  text-align: center;
}
.sorting-location-table .sorting-row-pending > td {
  background: #fff5df !important;
}
.sorting-location-table .sorting-row-scanned > td {
  background: #e4f3ea !important;
}
.sorting-location-table .sorting-row-scanned.is-group-start > td {
  border-top: 2px solid #9bcbb5;
}
.sorting-location-table .sorting-row-pending:hover > td {
  background: #ffedc7 !important;
}
.sorting-location-table .sorting-row-scanned:hover > td {
  background: #d8ecdf !important;
}
.sorting-location-table .sorting-row-ignored > td { background: #f0eef8; color: #4f486d; }
.sorting-location-table .sorting-row-ignored:hover > td { background: #e6e2f3 !important; }
.sorting-location-table .sorting-status-column {
  position: sticky;
  left: 0;
  z-index: 9;
  width: 78px;
  min-width: 78px;
  text-align: center;
}
.sorting-location-table th.sorting-status-column {
  z-index: 13;
  background: #edf3f0;
  box-shadow: 4px 0 7px rgba(38,64,55,.08);
}
.sorting-location-table td.sorting-status-column { box-shadow: 4px 0 7px rgba(38,64,55,.06); }
.badge-ignore {
  border: 1px solid #b8b0da;
  background: #ebe8f7;
  color: #554b86;
}
.sorting-scan-log-ignore { color: #62559a; }

/* 分拣当前订单信息条 */
.sorting-current-order-bar {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 12px;
  border-radius: 8px;
  background: #1a73e8;
  color: #fff;
}
.sorting-current-order-no {
  flex: 0 0 auto;
  font-size: 16px;
  white-space: nowrap;
}
.sorting-current-project {
  flex: 0 0 auto;
  min-width: 80px;
  max-width: 260px;
  padding-left: 14px;
  overflow: hidden;
  border-left: 1px solid rgba(255,255,255,.45);
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sorting-current-count,
.sorting-current-progress {
  flex: 0 0 auto;
  font-size: 13px;
  white-space: nowrap;
}
.sorting-current-count { opacity: .9; }
.sorting-current-progress { font-variant-numeric: tabular-nums; }
.sorting-order-actions { position: relative; flex: 0 0 auto; }
.sorting-order-actions-toggle {
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 4px;
  background: rgba(255,255,255,.12);
  color: #fff;
  cursor: pointer;
  font-size: 11px;
}
.sorting-order-actions-menu {
  position: absolute;
  top: 34px;
  left: 0;
  z-index: 70;
  width: 116px;
  padding: 4px;
  border: 1px solid #c6d3ce;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(20,54,44,.2);
}
.sorting-order-actions-menu[hidden] { display: none; }
.sorting-order-actions-menu button {
  width: 100%;
  min-height: 30px;
  padding: 4px 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
}
.sorting-order-actions-menu .is-complete { color: #176946; }
.sorting-order-actions-menu .is-complete:hover { background: #e8f5ee; }
.sorting-order-actions-menu .is-reset { color: #b83228; }
.sorting-order-actions-menu .is-reset:hover { background: #fff0ee; }
.sorting-operation-summary > b { display: block; margin-bottom: 12px; color: #28463b; }
.sorting-operation-summary > div { display: grid; grid-template-columns: repeat(4, auto); gap: 5px 10px; align-items: baseline; }
.sorting-operation-summary > div span { color: #71817c; font-size: 12px; }
.sorting-operation-summary > div strong { color: #176946; font-size: 18px; }
.sorting-operation-summary p { margin: 12px 0 0; color: #6d7d77; font-size: 12px; line-height: 1.6; }
.sorting-operation-summary label { display: grid; gap: 6px; margin-top: 14px; color: #70423e; font-size: 12px; }
.sorting-operation-summary label input { height: 36px; padding: 5px 9px; border: 1px solid #d4a4a0; border-radius: 4px; outline: none; }
.sorting-operation-summary label input:focus { border-color: #c0362c; box-shadow: 0 0 0 2px rgba(192,54,44,.1); }
.sorting-operation-summary.is-danger > b { color: #a52f27; }
.sorting-inline-input {
  height: 32px;
  min-width: 280px;
  max-width: 620px;
  margin-left: auto;
  flex: 1 1 360px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 7px 2px 10px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(20,70,135,.16);
}
.sorting-scan-icon { flex: 0 0 auto; font-size: 16px; }
.sorting-inline-input input {
  min-width: 100px;
  flex: 1 1 auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: #18352c;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 15px;
  letter-spacing: 0;
  text-align: center;
}
.sorting-inline-input input::placeholder { color: #83928d; }
.sorting-scan-hint {
  flex: 0 0 auto;
  color: #7a8a84;
  font-size: 10px;
  white-space: nowrap;
}
.sorting-rate-control {
  min-width: 116px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #52635d;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.sorting-rate-control input[type="range"] {
  width: 82px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: #1a73e8;
  cursor: pointer;
}
.sorting-rate-control output {
  min-width: 28px;
  font-weight: 700;
  text-align: right;
}
.sorting-user-actions {
  position: relative;
  min-width: 128px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-left: 10px;
  border-left: 1px solid rgba(255,255,255,.35);
}
.sorting-user-actions .sorting-settings-button {
  width: 30px;
  padding: 0;
  font-size: 16px;
}
.sorting-settings-panel {
  position: absolute;
  top: 36px;
  right: 0;
  z-index: 60;
  width: min(480px, calc(100vw - 24px));
  max-height: min(680px, calc(100vh - 72px));
  padding: 12px;
  overflow: hidden;
  border: 1px solid #bdccc6;
  border-radius: 6px;
  background: #fff;
  color: #304840;
  box-shadow: 0 14px 34px rgba(20,54,44,.22);
}
.sorting-settings-panel[data-active-tab="reminder"],
.sorting-settings-panel[data-active-tab="ignore"] {
  width: min(1120px, calc(100vw - 24px));
}
.sorting-settings-panel[hidden] { display: none; }
.sorting-settings-head {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e9e5;
  font-size: 14px;
}
.sorting-settings-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 12px;
  padding: 3px;
  border-radius: 5px;
  background: #edf2f0;
}
.sorting-user-actions .sorting-settings-tab {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: #52665f;
  font-weight: 700;
}
.sorting-user-actions .sorting-settings-tab:hover,
.sorting-user-actions .sorting-settings-tab:focus-visible { background: #f7faf9; color: #244b3e; }
.sorting-user-actions .sorting-settings-tab.is-active {
  background: #fff;
  color: #176b50;
  box-shadow: 0 1px 4px rgba(32,67,56,.16);
}
.sorting-settings-section {
  max-height: min(560px, calc(100vh - 160px));
  overflow-y: auto;
  padding: 2px 2px 2px 0;
}
.sorting-settings-section[hidden] { display: none; }
.sorting-settings-panel label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 10px;
  margin-bottom: 12px;
  color: #3b554c;
  font-size: 12px;
}
.sorting-settings-panel label:last-child { margin-bottom: 0; }
.sorting-settings-panel label.sorting-setting-toggle {
  grid-template-columns: minmax(0, 1fr) 38px;
  min-height: 30px;
  margin-bottom: 8px;
  padding: 3px 0;
  cursor: pointer;
}
.sorting-settings-panel .sorting-setting-toggle input[type="checkbox"] {
  position: relative;
  width: 36px;
  height: 20px;
  margin: 0;
  appearance: none;
  border: 1px solid #aebdb7;
  border-radius: 10px;
  outline: none;
  background: #d9e1de;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
.sorting-settings-panel .sorting-setting-toggle input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(24,54,44,.28);
  transition: transform .16s ease;
}
.sorting-settings-panel .sorting-setting-toggle input[type="checkbox"]:checked {
  border-color: #1683d8;
  background: #1683d8;
}
.sorting-settings-panel .sorting-setting-toggle input[type="checkbox"]:checked::after { transform: translateX(16px); }
.sorting-settings-panel .sorting-setting-toggle input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 3px rgba(22,131,216,.18); }
.sorting-settings-panel output {
  min-width: 42px;
  color: #1a73e8;
  font-weight: 800;
  text-align: right;
}
.sorting-settings-panel input[type="range"] {
  width: 100%;
  grid-column: 1 / -1;
  accent-color: #1a73e8;
  cursor: pointer;
}
.sorting-settings-panel .sorting-settings-select { grid-template-columns: 1fr; }
.sorting-settings-panel .sorting-settings-select select {
  width: 100%;
  height: 30px;
  padding: 3px 7px;
  border: 1px solid #c8d5d0;
  border-radius: 4px;
  outline: none;
  background: #f8faf9;
  color: #304840;
  font-size: 12px;
}
.sorting-settings-panel .sorting-settings-select select:focus { border-color: #1a73e8; box-shadow: 0 0 0 2px rgba(26,115,232,.12); }
.sorting-settings-panel .sorting-settings-select input {
  width: 100%;
  height: 30px;
  padding: 3px 7px;
  border: 1px solid #c8d5d0;
  border-radius: 4px;
  outline: none;
  background: #f8faf9;
  color: #304840;
  font-size: 12px;
}
.sorting-settings-panel .sorting-settings-select input:focus { border-color: #1a73e8; box-shadow: 0 0 0 2px rgba(26,115,232,.12); }
.sorting-speech-mode {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: -2px 0 12px;
  color: #3b554c;
  font-size: 12px;
}
.sorting-segmented {
  display: flex;
  padding: 2px;
  border-radius: 4px;
  background: #edf2f0;
}
.sorting-user-actions .sorting-segmented button {
  min-height: 25px;
  padding: 2px 9px;
  border: 0;
  background: transparent;
  color: #687b74;
}
.sorting-user-actions .sorting-segmented button:hover { background: #f7faf9; color: #35544a; }
.sorting-user-actions .sorting-segmented button.is-active { background: #fff; color: #176b50; box-shadow: 0 1px 3px rgba(32,67,56,.16); }
.sorting-rule-help {
  margin: 0 0 9px;
  color: #6d7f78;
  font-size: 11px;
  line-height: 1.5;
}
.sorting-rule-list {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}
.sorting-rule-empty {
  padding: 24px 12px;
  border: 1px dashed #cbd8d3;
  border-radius: 5px;
  background: #f8faf9;
  color: #7c8d86;
  text-align: center;
  font-size: 12px;
}
.sorting-rule-card {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #d6e0dc;
  border-radius: 5px;
  background: #fff;
}
.sorting-rule-media-group {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
@media (min-width: 981px) {
  .sorting-rule-card--ignore {
    display: grid;
    grid-template-columns: 122px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }
  .sorting-rule-card--reminder {
    display: grid;
    grid-template-columns: 112px minmax(260px, 1fr) minmax(110px, .48fr) minmax(390px, 1.65fr);
    align-items: center;
    gap: 6px;
  }
  .sorting-rule-card--ignore .sorting-rule-card-head,
  .sorting-rule-card--reminder .sorting-rule-card-head { margin-bottom: 0; }
  .sorting-rule-card--reminder .sorting-rule-message { margin-top: 0; }
  .sorting-rule-card--reminder .sorting-rule-media-actions { margin-top: 0; }
  .sorting-rule-card--reminder .sorting-rule-media-list { margin-top: 0; }
}
.sorting-rule-card.is-disabled { opacity: .58; background: #f4f6f5; }
.sorting-rule-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  color: #2f493f;
  font-size: 12px;
}
.sorting-rule-card-head b { margin-right: auto; }
.sorting-settings-panel .sorting-rule-enabled {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}
.sorting-settings-panel .sorting-rule-enabled input { margin: 0; accent-color: #1683d8; }
.sorting-user-actions .sorting-rule-delete {
  width: 25px;
  min-height: 25px;
  padding: 0;
  border-color: #d8e1dd;
  background: #fff;
  color: #778780;
  font-size: 17px;
  line-height: 1;
}
.sorting-user-actions .sorting-rule-delete:hover { border-color: #e0aaa5; background: #fff4f3; color: #b83228; }
.sorting-rule-condition {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(70px, .65fr) minmax(90px, 1fr);
  gap: 6px;
}
.sorting-rule-condition select,
.sorting-rule-condition input,
.sorting-rule-message {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 3px 7px;
  border: 1px solid #c8d5d0;
  border-radius: 4px;
  outline: none;
  background: #f9fbfa;
  color: #304840;
  font-size: 12px;
}
.sorting-rule-condition select:focus,
.sorting-rule-condition input:focus,
.sorting-rule-message:focus { border-color: #1683d8; box-shadow: 0 0 0 2px rgba(22,131,216,.1); }
.sorting-rule-message { margin-top: 6px; }
.sorting-rule-media-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}
.sorting-settings-panel .sorting-rule-media-upload {
  width: 42px;
  flex: 0 0 42px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 3px 5px;
  border: 1px solid #aac8bc;
  border-radius: 4px;
  background: #f3f8f6;
  color: #176b50;
  cursor: pointer;
  font-weight: 700;
}
.sorting-rule-media-upload input { display: none; }
.sorting-rule-link-field,
.sorting-rule-link-input {
  min-width: 0;
  height: 30px;
  padding: 3px 7px;
  border: 1px solid #c8d5d0;
  border-radius: 4px;
  outline: none;
  font-size: 12px;
}
.sorting-rule-link-field {
  width: 108px;
  flex: 0 0 108px;
  background: #f9fbfa;
  color: #304840;
}
.sorting-rule-link-input {
  width: 104px;
  flex: 0 0 104px;
}
.sorting-rule-link-input[hidden] { display: none; }
.sorting-user-actions .sorting-rule-link-add {
  width: 46px;
  flex: 0 0 46px;
  min-height: 30px;
  padding: 3px 5px;
  border-color: #aac8bc;
  background: #f3f8f6;
  color: #176b50;
}
.sorting-rule-media-details {
  min-width: 122px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  margin-top: 0;
  border: 1px solid #d7dfdc;
  border-radius: 3px;
  background: #f8faf9;
}
.sorting-rule-media-details summary {
  width: 122px;
  min-width: 122px;
  flex: 0 0 122px;
  height: 27px;
  padding: 4px 7px;
  overflow: hidden;
  color: #53635d;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sorting-rule-media-details[open] summary {
  border-right: 1px solid #dfe6e3;
  border-bottom: 0;
}
.sorting-rule-media-list {
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  margin-top: 5px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.sorting-rule-media-details .sorting-rule-media-list { margin-top: 0; padding: 3px 5px; }
.sorting-rule-media-empty { color: #82918c; font-size: 11px; }
.sorting-rule-media-chip {
  min-width: 0;
  max-width: 320px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 4px 3px 7px;
  overflow: hidden;
  border: 1px solid #d4ded9;
  border-radius: 4px;
  background: #f7f9f8;
  color: #65756f;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sorting-rule-media-chip b { color: #2d5f4f; }
.sorting-rule-media-name {
  min-width: 0;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sorting-rule-media-priority {
  width: 62px;
  height: 22px;
  flex: 0 0 62px;
  padding: 0 2px;
  border: 1px solid #cbd6d1;
  border-radius: 3px;
  outline: none;
  background: #eef3f7;
  color: #42544d;
  font-size: 10px;
}
.sorting-rule-media-priority:focus { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.sorting-user-actions .sorting-rule-media-chip button {
  width: 20px;
  min-height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #86938e;
  font-size: 14px;
}
.sorting-cabinet-preview {
  margin-top: -2px;
  padding: 8px;
  border: 1px solid #d9e2de;
  border-radius: 5px;
  background: #f7faf8;
  font-size: 11px;
}
.sorting-cabinet-preview > b { display: block; margin-bottom: 6px; color: #375249; }
.sorting-cabinet-preview > div { display: flex; flex-wrap: wrap; gap: 5px; }
.sorting-cabinet-preview span { padding: 2px 6px; border-radius: 3px; background: #eaf2ee; color: #62746d; }
.sorting-cabinet-preview span b { color: #24654f; }
.sorting-user-actions .sorting-rule-add {
  width: 100%;
  min-height: 32px;
  margin-top: 9px;
  border: 1px dashed #89aa9e;
  background: #f4f9f7;
  color: #176b50;
  font-weight: 700;
}
.sorting-user-actions .sorting-rule-add:hover { border-color: #4d8d75; background: #eaf5f0; color: #125a43; }
.sorting-user-name {
  max-width: 110px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sorting-user-actions button {
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 4px;
  background: rgba(255,255,255,.12);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
}
.sorting-user-actions button:hover,
.sorting-user-actions button:focus-visible {
  outline: none;
  background: #fff;
  color: #1557b0;
}
@media (max-width: 720px) {
  .sorting-rule-condition { grid-template-columns: 1fr; }
}
.sorting-inline-input select {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid #d4dfda;
  border-radius: 4px;
  outline: 0;
  background: #f8faf9;
  color: #345047;
  font-size: 11px;
}

@media (max-width: 1180px) {
  .sorting-current-order-bar { flex-wrap: wrap; }
  .sorting-inline-input { min-width: 100%; max-width: none; margin-left: 0; }
}

@media (max-width: 768px) {
  .sorting-current-project { max-width: 34vw; }
  .sorting-page { padding: 8px 12px 6px; }
  .sorting-left-panel { width: 148px; flex-basis: 148px; }
  .sorting-left-panel.is-collapsed { width: 28px; flex-basis: 28px; }
  .sorting-scan-hint { display: none; }
  .sorting-reminder-banner { left: 4px; right: 4px; }
  .sorting-reminder-banner-content { gap: 8px; padding: 6px 10px; }
  .sorting-reminder-banner strong { font-size: 22px; }
}

/* 分拣模型联动 */
.sorting-model-preview {
  display: none;
  margin-top: -4px;
}
.sorting-model-preview.is-visible { display: block; }
.sorting-model-preview.is-user-hidden { display: none !important; }
.sorting-workspace > #sortingPreview.is-visible {
  position: sticky;
  top: 145px;
  z-index: 16;
  background: var(--bg);
  box-shadow: 0 -8px 0 var(--bg), 0 5px 10px rgba(31, 65, 54, .08);
}
.sorting-model-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.sorting-model-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.sorting-model-card > header {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 8;
  min-height: 32px;
  padding: 3px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 0;
  background: transparent;
  color: #253e36;
  font-size: 13px;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(255,255,255,.96), 0 0 5px rgba(255,255,255,.92);
}
.sorting-model-card > header > * { pointer-events: auto; }
.sorting-model-card > header > div { min-width: 0; }
.sorting-model-card > header b { white-space: nowrap; }
.sorting-model-card > header .sorting-model-window-title {
  position: absolute;
  top: 5px;
  left: 50%;
  z-index: 2;
  padding: 2px 7px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: rgba(255,255,255,.82);
  color: #203d56;
  box-shadow: 0 1px 4px rgba(26,52,74,.14);
}
.sorting-model-card > header div span { margin-left: 5px; color: #71817c; font-size: 12px; }
.sorting-panel-header-actions { display: flex; align-items: center; gap: 6px; }
.sorting-panel-view-toggle {
  display: flex;
  padding: 2px;
  border-radius: 4px;
  background: #e7eeeb;
}
.sorting-panel-view-toggle[hidden] { display: none; }
.sorting-panel-view-toggle button {
  min-height: 24px;
  padding: 2px 7px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #62746d;
  cursor: pointer;
  font-size: 10px;
}
.sorting-panel-view-toggle button.is-active { background: #fff; color: #176b50; box-shadow: 0 1px 3px rgba(31,65,54,.16); }
.sorting-model-status {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 4px;
  background: #e8eeeb;
  color: #65746f;
  font-size: 11px;
  font-weight: 700;
}
.sorting-model-status.is-loading { background: var(--warning-soft); color: #8b5b19; }
.sorting-model-status.is-ready { background: var(--success-soft); color: #176946; }
.sorting-model-status.is-error { background: var(--danger-soft); color: #a43232; }
.sorting-model-frame {
  position: relative;
  height: clamp(250px, 42vh, 390px);
  min-height: 250px;
  background: #f2f5f3;
}
.sorting-model-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.sorting-model-loading,
.sorting-model-fallback {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #6d7c77;
  background: rgba(245,248,246,.94);
  font-size: 13px;
}
.sorting-model-loading.is-visible { display: flex; }
.sorting-model-fallback.is-visible { display: flex; flex-direction: column; }
.sorting-reminder-media {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: block;
  background: #fff;
}
.sorting-reminder-media[hidden] { display: none; }
.sorting-reminder-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #edf1ef;
}
.sorting-reminder-stage > img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  cursor: zoom-in;
}
.sorting-reminder-stage > video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border: 0;
  object-fit: contain;
  object-position: center;
  background: #111;
  cursor: pointer;
}
.sorting-reminder-stage > iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.sorting-reminder-open-media {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #a9c9bd;
  border-radius: 4px;
  background: rgba(255,255,255,.94);
  color: #176b50;
  box-shadow: 0 2px 7px rgba(20,54,44,.12);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}
.sorting-reminder-open-media:hover { border-color: #6fa693; background: #fff; }
.sorting-reminder-link-notice {
  min-width: min(360px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 22px;
  border: 1px solid #cbd8d3;
  border-radius: 5px;
  background: #fff;
  color: #304840;
  box-shadow: 0 4px 16px rgba(20,54,44,.1);
  text-align: center;
  cursor: pointer;
}
.sorting-reminder-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border: 1px solid #a9c9bd;
  border-radius: 4px;
  background: rgba(255,255,255,.94);
  color: #176b50;
  font-size: 11px;
  text-decoration: none;
}
.sorting-reminder-nav {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 4px 6px;
  border: 1px solid #cbd8d3;
  border-radius: 4px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 3px 10px rgba(20,54,44,.14);
}
.sorting-reminder-nav[hidden] { display: none; }
.sorting-reminder-nav button { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 3px; background: #eaf2ee; color: #275c4b; cursor: pointer; font-size: 18px; }
.sorting-reminder-nav span { min-width: 34px; color: #4f625b; font-size: 11px; text-align: center; }

@media (max-width: 980px) {
  .sorting-workspace > #sortingPreview.is-visible { position: static; }
  .sorting-model-grid { grid-template-columns: 1fr; }
  .sorting-model-frame,
  .sorting-model-frame iframe { min-height: 340px; height: 340px; }
}

/* 分拣工作台：统一极简配色 */
.main-content.is-sorting-page {
  --sorting-accent: #2563eb;
  --sorting-accent-soft: #eef4ff;
  --sorting-success: #17805b;
  --sorting-success-soft: #f0f8f4;
  --sorting-warning: #b66a12;
  --sorting-warning-soft: #fff9ed;
  --sorting-danger: #c2413a;
  --sorting-ink: #202825;
  --sorting-muted: #68736f;
  --sorting-line: #d9dfdc;
  --sorting-surface: #fbfcfd;
  --sorting-canvas: #edf1f4;
  background: var(--sorting-canvas);
}
body:has(.main-content.is-sorting-page) .sidebar {
  border-right-color: #2a3033;
  background: #181c1f;
  box-shadow: none;
}
body:has(.main-content.is-sorting-page) .sidebar-logo { background: #141719; }
body:has(.main-content.is-sorting-page) .brand-mark { background: var(--sorting-accent, #2563eb); }
body:has(.main-content.is-sorting-page) .sidebar-menu a { color: #aeb5b2; }
body:has(.main-content.is-sorting-page) .sidebar-menu a:hover { background: #23282b; color: #fff; }
body:has(.main-content.is-sorting-page) .sidebar-menu a.active { background: #252b30; color: #fff; }
body:has(.main-content.is-sorting-page) .sidebar-menu a.active::before { background: #4f83f1; }
body:has(.main-content.is-sorting-page) .sidebar-menu a.active .icon { background: #303b4a; }

.main-content.is-sorting-page #pageContainer,
.sorting-page { background: var(--sorting-canvas); }
.sorting-page { gap: 8px; padding: 8px; }
.sorting-left-panel,
.sorting-current-order-bar,
.sorting-location-detail-panel,
.sorting-model-card {
  border-color: var(--sorting-line);
  border-radius: 4px;
  background: var(--sorting-surface);
  box-shadow: none;
}
.sorting-left-panel { padding: 9px; }
.sorting-left-header {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--sorting-line);
  color: var(--sorting-ink);
}
.sorting-panel-toggle { color: var(--sorting-muted); }
.sorting-panel-toggle:hover,
.sorting-panel-toggle:focus-visible {
  border-color: #b9c8df;
  background: var(--sorting-accent-soft);
  color: var(--sorting-accent);
}
.sorting-left-panel.is-collapsed:hover { border-color: #b9c8df; background: #fff; }
.sorting-order-section-title {
  margin: 9px 0 5px;
  padding-left: 7px;
  border-left: 2px solid #aeb7b3;
  color: var(--sorting-ink);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}
.sorting-order-section-title.is-current { border-left-color: var(--sorting-accent); }
.sorting-order-section-title.is-progress { border-left-color: var(--sorting-warning); }
.sorting-order-section-title.is-complete { border-left-color: var(--sorting-success); }
.sorting-order-card {
  margin-bottom: 5px;
  padding: 8px 9px;
  border: 1px solid var(--sorting-line);
  border-radius: 4px;
  background: #f8fafb;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.sorting-order-card:hover { border-color: #aebbd0; background: #f1f5f9; }
.sorting-order-card.is-current { border-color: var(--sorting-accent); background: var(--sorting-accent-soft); }
.sorting-order-card.is-progress:not(.is-current) { background: #fff9ef; }
.sorting-order-card.is-complete:not(.is-current) { background: #f1f8f4; }
.sorting-order-card-progress {
  height: 3px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 0;
  background: #e6e9e7;
}
.sorting-order-card-progress > div { height: 100%; background: #9ea8a4; }
.sorting-order-card.is-current .sorting-order-card-progress > div { background: var(--sorting-accent); }
.sorting-order-card.is-progress .sorting-order-card-progress > div { background: var(--sorting-warning); }
.sorting-order-card.is-complete .sorting-order-card-progress > div { background: var(--sorting-success); }
.sorting-completed-search,
.sorting-location-search,
.sorting-column-search { border-color: var(--sorting-line); border-radius: 3px; }
.sorting-completed-search:focus,
.sorting-location-search:focus,
.sorting-column-search:focus { border-color: var(--sorting-accent); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.sorting-side-scan-log { border-top-color: var(--sorting-line); }
.sorting-side-scan-header { color: var(--sorting-ink); }

.sorting-current-order-bar {
  min-height: 46px;
  padding: 5px 9px;
  border: 1px solid var(--sorting-line);
  border-left: 4px solid var(--sorting-accent);
  background: #f3f7ff;
  color: var(--sorting-ink);
}
.sorting-workspace > #sortingCurrentOrder { box-shadow: 0 2px 6px rgba(28,38,34,.06); }
.sorting-current-project { border-left-color: var(--sorting-line); }
.sorting-current-count { color: var(--sorting-muted); opacity: 1; }
.sorting-current-progress { color: var(--sorting-success); font-weight: 750; }
.sorting-order-actions-toggle,
.sorting-user-actions button {
  border-color: #cbd3d0;
  background: #e8eef5;
  color: #46514d;
}
.sorting-order-actions-toggle:hover,
.sorting-order-actions-toggle:focus-visible,
.sorting-user-actions button:hover,
.sorting-user-actions button:focus-visible {
  border-color: #a8b9d4;
  background: var(--sorting-accent-soft);
  color: var(--sorting-accent);
}
.sorting-page button:not(.sorting-table-sort):not(.sorting-column-drag) {
  border-color: #c6d1dd;
  background: #e8eef5;
  color: #364653;
}
.sorting-page button:not(.sorting-table-sort):not(.sorting-column-drag):hover,
.sorting-page button:not(.sorting-table-sort):not(.sorting-column-drag):focus-visible {
  border-color: #9fb3ca;
  background: #dce7f3;
  color: #2456a6;
}
.sorting-page .sorting-settings-tab.is-active,
.sorting-page .sorting-segmented button.is-active,
.sorting-page .sorting-panel-view-toggle button.is-active {
  border-color: #a9bee0;
  background: #dbe8fb;
  color: var(--sorting-accent);
}
.sorting-page .sorting-rule-delete,
.sorting-page .sorting-order-actions-menu .is-reset {
  border-color: #e5c6c3;
  background: #faeeee;
  color: var(--sorting-danger);
}
.sorting-page .sorting-order-actions-menu .is-complete {
  border-color: #bcd8ca;
  background: #eaf5ef;
  color: var(--sorting-success);
}
.sorting-inline-input {
  border-color: #cbd3d0;
  border-radius: 4px;
  background: #fff;
  box-shadow: none;
}
.sorting-user-actions { border-left-color: var(--sorting-line); }
.sorting-scan-hint,
.sorting-user-name { color: var(--sorting-muted); }

#sortingGrid {
  gap: 6px !important;
  background: var(--sorting-canvas);
  box-shadow: 0 -10px 0 var(--sorting-canvas);
}
.sorting-location-card,
.sorting-location-card.is-unstarted,
.sorting-location-card.is-progress,
.sorting-location-card.is-complete {
  border-width: 1px;
  border-color: var(--sorting-line);
  border-left-width: 4px;
  border-radius: 4px;
  background: #f8fafb;
}
.sorting-location-card.is-unstarted { border-left-color: #aeb7b3; }
.sorting-location-card.is-progress { border-left-color: var(--sorting-warning); background: #fff8eb; }
.sorting-location-card.is-complete { border-left-color: var(--sorting-success); background: #edf7f2; }
.sorting-location-card:hover { border-color: #aebbd0; filter: none; box-shadow: none; }
.sorting-location-card.is-selected {
  border-color: var(--sorting-accent);
  outline: 2px solid rgba(37,99,235,.28);
  outline-offset: -2px;
  box-shadow: none;
}
.sorting-location-card-title,
.sorting-location-card.is-progress .sorting-location-card-title,
.sorting-location-card.is-complete .sorting-location-card-title { color: var(--sorting-ink); }
.sorting-location-card-name { color: #3f4945; }
.sorting-location-card-count { color: var(--sorting-muted); }
.sorting-location-damaged { color: #b3261e; font-weight: 800; }
.sorting-location-card-progress { height: 3px; border-radius: 0; background: #e7eae8; }
.sorting-location-card-progress > div { border-radius: 0; background: #a6afab; }
.sorting-location-card.is-progress .sorting-location-card-progress > div { background: var(--sorting-warning); }
.sorting-location-card.is-complete .sorting-location-card-progress > div { background: var(--sorting-success); }

.sorting-location-detail-panel { padding: 7px; background: #f9fbfc; }
.sorting-location-table .sorting-row-pending > td { background: var(--sorting-warning-soft) !important; }
.sorting-location-table .sorting-row-scanned > td { background: var(--sorting-success-soft) !important; }
.sorting-location-table .sorting-row-ignored > td { background: #f6f4f8; color: #514b5b; }
.sorting-location-table .sorting-row-pending:hover > td { background: #fff4dd !important; }
.sorting-location-table .sorting-row-scanned:hover > td { background: #e7f4ed !important; }
.sorting-location-table .sorting-row-ignored:hover > td { background: #eeeaf2 !important; }
.sorting-location-table th.sorting-status-column { background: #f3f5f4; box-shadow: 3px 0 5px rgba(35,44,40,.05); }
.sorting-location-table td.sorting-status-column { box-shadow: 3px 0 5px rgba(35,44,40,.04); }

.sorting-location-table .sorting-row-replacement > td {
  background: #fde8e7 !important;
  color: #842a27;
}
.sorting-location-table .sorting-row-replacement:hover > td { background: #fbd8d5 !important; }
.badge-replacement {
  border: 1px solid #d94a43;
  background: #c9302c;
  color: #fff;
  font-size: 10px;
  white-space: nowrap;
}
.sorting-scan-log-replacement { color: #b3261e; font-weight: 700; }

.sorting-status-sheet {
  --sorting-accent: #176b55;
  --sorting-accent-dark: #0f5544;
  --sorting-accent-soft: #e6f2ed;
  --sorting-success: #1d7b55;
  --sorting-danger: #b83f3a;
  display: grid;
  gap: 12px;
}
.sorting-status-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid #d9e0e5; }
.sorting-status-item > div { display: flex; flex-direction: column; gap: 3px; }
.sorting-status-item > div:last-child { align-items: flex-end; }
.sorting-status-item span { color: #687780; font-size: 12px; }
.sorting-status-item strong { padding: 3px 7px; border-radius: 3px; font-size: 11px; }
.sorting-status-item strong.is-pending { background: #fff0d7; color: #8c5912; }
.sorting-status-item strong.is-scanned { background: #e4f4eb; color: #176946; }
.sorting-status-item strong.is-damaged { background: #f9d9d6; color: #a12621; }
.sorting-status-actions { display: grid; gap: 9px; }
.sorting-status-actions > button {
  min-height: 38px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 7px 11px;
  border: 1px solid #b8c4cc;
  border-radius: 4px;
  background: #eef3f6;
  color: #29404f;
  cursor: pointer;
  font-weight: 700;
}
.sorting-status-actions > button span { color: inherit; font-size: 11px; font-weight: 500; opacity: .78; }
.sorting-status-actions > button.is-selected { border-color: #1769d9; box-shadow: inset 0 0 0 1px #1769d9; }
.sorting-status-actions > button.is-replacement { border-color: #c83b35; background: #c9302c; color: #fff; }
.sorting-status-actions > button.is-replacement.is-selected { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px #c9302c; }
.sorting-status-actions > button.is-complete { border-color: #16814e; background: #16814e; color: #fff; }

.quality-replacement-card .card-header { display: flex; align-items: center; justify-content: space-between; }
.quality-replacement-total { color: #b3261e; font-size: 13px; font-weight: 800; }
.quality-replacement-pending > td { background: #fff1ef; }
.quality-replacement-completed > td { background: #edf8f1; }

.sorting-column-panel,
.sorting-settings-panel,
.sorting-order-actions-menu {
  border-color: var(--sorting-line);
  border-radius: 4px;
  box-shadow: 0 12px 28px rgba(28,38,34,.16);
}
.sorting-settings-tabs,
.sorting-segmented { border-radius: 3px; background: #eef1ef; }
.sorting-page .sorting-user-actions .sorting-settings-tab.is-active {
  border-color: #1557b0;
  background: #2563a9;
  color: #fff;
  box-shadow: inset 0 2px 4px rgba(15,51,92,.24), 0 1px 2px rgba(15,51,92,.12);
  transform: translateY(1px);
}
.sorting-page .sorting-user-actions .sorting-settings-tabs .sorting-settings-tab.is-active:hover,
.sorting-page .sorting-user-actions .sorting-settings-tabs .sorting-settings-tab.is-active:focus-visible {
  background: #1f5798;
  color: #fff;
}
.sorting-user-actions .sorting-segmented button.is-active { color: var(--sorting-accent); box-shadow: none; }
.sorting-settings-panel output { color: var(--sorting-accent); }
.sorting-settings-panel .sorting-setting-toggle input[type="checkbox"]:checked { border-color: var(--sorting-accent); background: var(--sorting-accent); }
.sorting-rule-card,
.sorting-rule-empty,
.sorting-cabinet-preview { border-color: var(--sorting-line); border-radius: 4px; box-shadow: none; }
.sorting-user-actions .sorting-rule-add,
.sorting-settings-panel .sorting-rule-media-upload,
.sorting-user-actions .sorting-rule-link-add { border-color: #b8c5c0; background: #f7f9f8; color: #46514d; }

.sorting-model-grid { gap: 8px; }
.sorting-workspace > #sortingPreview.is-visible { background: var(--sorting-canvas); box-shadow: 0 -8px 0 var(--sorting-canvas); }
.sorting-model-card { overflow: hidden; background: #f8fafb; }
.sorting-model-card > header { color: var(--sorting-ink); }
.sorting-panel-view-toggle { background: rgba(238,241,239,.92); }
.sorting-panel-view-toggle button.is-active { color: var(--sorting-accent); box-shadow: none; }
.sorting-model-status { border-radius: 3px; background: rgba(237,240,238,.92); color: var(--sorting-muted); }
.sorting-model-frame { background: #eef2f4; }
.sorting-reminder-stage { background: #eef2f4; }
.sorting-reminder-open-media,
.sorting-reminder-open-link,
.sorting-reminder-nav { border-color: var(--sorting-line); border-radius: 3px; color: var(--sorting-accent); box-shadow: 0 2px 7px rgba(28,38,34,.10); }
.sorting-reminder-nav button { border-radius: 2px; background: #eef1ef; color: #46514d; }

.sorting-reminder-banner-content {
  border: 1px solid #9f1018;
  border-left: 5px solid #76080e;
  border-radius: 4px;
  background: #d71920;
  color: #fff;
  box-shadow: 0 5px 16px rgba(118,8,14,.28);
}
.sorting-reminder-banner {
  top: 58px;
  right: auto;
  left: 50%;
  width: min(900px, calc(100% - 24px));
  transform: translate(-50%, -6px);
}
.sorting-reminder-banner.is-visible { transform: translate(-50%, 0); }
.sorting-reminder-banner-label {
  border-radius: 2px;
  background: #8f0c12;
  color: #fff;
}
.sorting-reminder-banner strong { color: #fff; }

@media (max-width: 1180px) {
  .sorting-reminder-banner { top: 94px; }
}

@media (max-width: 768px) {
  .sorting-reminder-banner {
    top: 92px;
    left: 50%;
    right: auto;
    width: calc(100% - 8px);
  }
}

/* 分拣主状态使用高辨识度颜色，保持数据密集界面的清晰层级。 */
.sorting-page .sorting-current-order-bar {
  border-color: #0f56bd;
  border-left-color: #083d93;
  background: #1769d9;
  color: #fff;
  box-shadow: 0 3px 10px rgba(15,86,189,.24);
}
.sorting-page .sorting-current-project { border-left-color: rgba(255,255,255,.48); }
.sorting-page .sorting-current-count,
.sorting-page .sorting-current-progress,
.sorting-page .sorting-user-name { color: #fff; }
.sorting-page .sorting-current-count { opacity: .92; }
.sorting-page .sorting-current-progress { color: #dfffe9; }

.sorting-page .sorting-location-card,
.sorting-page .sorting-location-card.is-unstarted {
  border-color: #79a8eb;
  border-left-color: #2563d9;
  background: #e7f0ff;
}
.sorting-page .sorting-location-card.is-progress {
  border-color: #efa619;
  border-left-color: #d97706;
  background: #fff0bd;
}
.sorting-page .sorting-location-card.is-complete {
  border-color: #2cac73;
  border-left-color: #078554;
  background: #d6f5e5;
}
.sorting-page .sorting-location-card:hover {
  border-color: #356fc9;
  filter: brightness(.97);
  box-shadow: 0 3px 9px rgba(25,80,150,.18);
}
.sorting-page .sorting-location-card.is-selected {
  border-color: #0d4fb8;
  outline: 3px solid rgba(13,79,184,.38);
  outline-offset: -3px;
  box-shadow: 0 4px 12px rgba(13,79,184,.22);
}
.sorting-page .sorting-location-card-title { color: #174e9b; }
.sorting-page .sorting-location-card.is-progress .sorting-location-card-title { color: #984600; }
.sorting-page .sorting-location-card.is-complete .sorting-location-card-title { color: #066743; }
.sorting-page .sorting-location-card-name { color: #273c51; }
.sorting-page .sorting-location-card-count { color: #42566a; font-weight: 700; }
.sorting-page .sorting-location-card-progress {
  height: 7px;
  margin-top: 4px;
  border: 1px solid rgba(40,75,112,.18);
  border-radius: 4px;
  background: rgba(255,255,255,.72);
}
.sorting-page .sorting-location-card-progress > div {
  border-radius: 3px;
  background: #3478df;
}
.sorting-page .sorting-location-card.is-progress .sorting-location-card-progress > div { background: #e78608; }
.sorting-page .sorting-location-card.is-complete .sorting-location-card-progress > div { background: #07935d; }
.sorting-page .sorting-location-card .sorting-location-card-progress {
  display: flex;
  align-items: stretch;
}
.sorting-page .sorting-location-card .sorting-location-card-progress > .sorting-location-progress-completed {
  flex: 0 0 auto;
}
.sorting-page .sorting-location-card.is-progress .sorting-location-card-progress > .sorting-location-progress-damaged,
.sorting-page .sorting-location-card.is-complete .sorting-location-card-progress > .sorting-location-progress-damaged,
.sorting-page .sorting-location-card.is-unstarted .sorting-location-card-progress > .sorting-location-progress-damaged {
  flex: 0 0 auto;
  min-width: 5px;
  border-radius: 0;
  background: #dc2626;
  box-shadow: inset 1px 0 0 rgba(255,255,255,.72);
}

.sorting-page .sorting-location-card.is-scan-flashing {
  animation: sorting-location-full-flash .6s ease-in-out 4;
}
.sorting-page .sorting-location-card.is-scan-flashing::after {
  content: attr(data-location-number);
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  pointer-events: none;
  color: #fff;
  font-size: 108px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0,0,0,.24), 0 0 10px rgba(0,0,0,.28);
  opacity: 0;
  transform: translate(-50%, -50%) scale(.72);
  animation: sorting-location-number-flash .6s ease-in-out 4;
}
#sortingGrid.is-very-dense .sorting-location-card.is-scan-flashing::after { font-size: 99px; }
.sorting-page .sorting-location-card.is-scan-flashing .sorting-location-card-title,
.sorting-page .sorting-location-card.is-scan-flashing .sorting-location-card-name,
.sorting-page .sorting-location-card.is-scan-flashing .sorting-location-card-count {
  animation: sorting-location-flash-text .6s ease-in-out 4;
}
.sorting-page .sorting-location-card.is-scan-flashing .sorting-location-card-progress {
  animation: sorting-location-flash-track .6s ease-in-out 4;
}
@keyframes sorting-location-full-flash {
  0%, 100% { transform: scale(1); }
  50% {
    border-color: var(--sorting-flash-color, #078554);
    background: var(--sorting-flash-color, #078554);
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--sorting-flash-color, #078554), 0 6px 18px rgba(18,54,38,.34);
    transform: scale(1.025);
  }
}
@keyframes sorting-location-flash-text {
  0%, 100% { opacity: 1; }
  50% { color: #fff; opacity: .16; }
}
@keyframes sorting-location-flash-track {
  0%, 100% { opacity: 1; }
  50% { border-color: rgba(255,255,255,.9); background: rgba(255,255,255,.38); }
}
@keyframes sorting-location-number-flash {
  0%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(.72); }
  35%, 65% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.sorting-group-open {
  min-height: 28px;
  flex: 0 0 auto;
  padding: 3px 9px;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 4px;
  background: rgba(255,255,255,.16);
  color: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}
.sorting-page .sorting-group-open:hover,
.sorting-page .sorting-group-open:focus-visible { border-color: #fff; background: #fff; color: #1557b0; }

.sorting-group-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(20,30,38,.42);
}
.sorting-group-dialog {
  width: min(1060px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #aebdca;
  border-radius: 6px;
  background: #f7f9fb;
  color: #243746;
  box-shadow: 0 20px 48px rgba(17,35,52,.28);
}
.sorting-group-dialog > header {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #cad5df;
  background: #1769d9;
  color: #fff;
}
.sorting-group-dialog > header > div { min-width: 0; flex: 1; }
.sorting-group-dialog h3 { margin: 0; font-size: 18px; letter-spacing: 0; }
.sorting-group-dialog header p { margin: 3px 0 0; overflow: hidden; font-size: 11px; opacity: .86; text-overflow: ellipsis; white-space: nowrap; }
.sorting-group-close {
  width: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 4px;
  background: rgba(255,255,255,.12);
  color: #fff;
  cursor: pointer;
  font-size: 20px;
}
.sorting-group-lock {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-bottom: 1px solid #c8d8e8;
  background: #e9f2ff;
  color: #315776;
  font-size: 12px;
}
.sorting-group-lock b { color: #1557b0; }
.sorting-group-lock.is-locked { border-bottom-color: #e1c783; background: #fff4d2; color: #725313; }
.sorting-group-lock.is-locked b { color: #a14e00; }
.sorting-group-lock.is-reset-warning { border-bottom-color: #efb3ae; background: #fff0ee; color: #8d332c; }
.sorting-group-lock.is-reset-warning b { color: #c0362c; }
.sorting-group-recommendations,
.sorting-group-custom { padding: 10px 14px; }
.sorting-group-recommendations { border-bottom: 1px solid #d4dde5; background: #fff; }
.sorting-group-custom { min-height: 0; display: flex; flex: 1; flex-direction: column; overflow: hidden; }
.sorting-group-section-title { min-height: 25px; display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.sorting-group-section-title > b { font-size: 13px; }
.sorting-group-section-title > span { color: #71818f; font-size: 11px; }
.sorting-group-plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.sorting-group-plan {
  min-width: 0;
  min-height: 66px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  padding: 8px 10px;
  border: 1px solid #bdcad5;
  border-radius: 5px;
  background: #f5f8fb;
  color: #304655;
  cursor: pointer;
  text-align: left;
}
.sorting-group-plan > b { color: #194e91; font-size: 13px; }
.sorting-group-plan > span { grid-column: 1 / -1; overflow: hidden; color: #71818e; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sorting-group-plan > strong { grid-column: 2; grid-row: 1; color: #1769d9; font-size: 11px; }
.sorting-group-plan:hover:not(:disabled) { border-color: #4c83c7; background: #edf4ff; }
.sorting-group-plan.is-active { border-color: #1769d9; background: #dcecff; box-shadow: inset 0 0 0 1px #1769d9; }
.sorting-group-plan:disabled { cursor: not-allowed; opacity: .48; }
.sorting-group-summary { margin-left: auto; display: flex; align-items: center; gap: 9px; color: #687986; font-size: 11px; }
.sorting-group-summary b { color: #1557b0; font-size: 13px; }
.sorting-group-toolbar { display: flex; gap: 6px; margin-bottom: 7px; }
.sorting-group-toolbar input {
  width: min(340px, 45%);
  height: 32px;
  padding: 4px 9px;
  border: 1px solid #b9c7d2;
  border-radius: 4px;
  outline: none;
  background: #fff;
  color: #263b4a;
}
.sorting-group-toolbar input:focus { border-color: #1769d9; box-shadow: 0 0 0 2px rgba(23,105,217,.12); }
.sorting-group-toolbar button,
.sorting-group-dialog footer button {
  min-height: 32px;
  padding: 4px 11px;
  border: 1px solid #b4c3cf;
  border-radius: 4px;
  background: #e8eef5;
  color: #304655;
  cursor: pointer;
}
.sorting-group-toolbar button { border-color: #1769d9; background: #1769d9; color: #fff; font-weight: 700; }
.sorting-group-list {
  min-height: 100px;
  flex: 1;
  overflow: auto;
  border: 1px solid #cbd5dd;
  border-radius: 4px;
  background: #fff;
}
.sorting-group-row {
  min-width: 720px;
  display: grid;
  grid-template-columns: 28px 34px minmax(150px, 210px) minmax(220px, 1fr) 70px 54px;
  align-items: center;
  gap: 7px;
  min-height: 39px;
  padding: 4px 8px;
  border-bottom: 1px solid #e1e7ec;
}
.sorting-group-row:last-child { border-bottom: 0; }
.sorting-group-row:hover { background: #f3f7fb; }
.sorting-group-check { display: flex; justify-content: center; }
.sorting-group-check input { width: 16px; height: 16px; margin: 0; accent-color: #1769d9; }
.sorting-group-index { color: #81909b; font-size: 11px; text-align: center; }
.sorting-group-name {
  min-width: 0;
  height: 29px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 3px;
  outline: none;
  background: transparent;
  color: #203746;
  font-weight: 700;
}
.sorting-group-name:hover { border-color: #c5d0d9; background: #fff; }
.sorting-group-name:focus { border-color: #1769d9; background: #fff; box-shadow: 0 0 0 2px rgba(23,105,217,.1); }
.sorting-group-sources { min-width: 0; overflow: hidden; color: #6e7e8a; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sorting-group-count { color: #176946; font-size: 12px; text-align: right; }
.sorting-group-count.is-over { color: #c0362c; }
.sorting-group-split {
  min-height: 27px;
  padding: 2px 7px;
  border: 1px solid #b7c6d1;
  border-radius: 3px;
  background: #eef3f7;
  color: #315b7c;
  cursor: pointer;
  font-size: 11px;
}
.sorting-group-split:hover:not(:disabled) { border-color: #1769d9; background: #e5effd; color: #1557b0; }
.sorting-group-split:disabled { cursor: not-allowed; opacity: .34; }
.sorting-group-dialog > footer {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid #cbd6df;
  background: #fff;
}
.sorting-group-dialog footer > div { display: flex; gap: 7px; }
.sorting-group-dialog footer button:disabled { cursor: not-allowed; opacity: .42; }
.sorting-group-dialog footer .sorting-group-save { border-color: #1769d9; background: #1769d9; color: #fff; font-weight: 700; }
.sorting-group-dialog footer .sorting-group-reset { color: #8a4c16; }

@media (max-width: 760px) {
  .sorting-group-overlay { padding: 6px; }
  .sorting-group-dialog { width: calc(100vw - 12px); max-height: calc(100vh - 12px); }
  .sorting-group-plan-grid { grid-template-columns: 1fr; }
  .sorting-group-plan { min-height: 54px; }
  .sorting-group-summary span { display: none; }
}

/* 分拣工作区统一为打包作业的命令栏 + 工作区布局 */
.sorting-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100vh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #edf1ef;
}
.sorting-command-bar {
  position: relative;
  z-index: 90;
  min-height: 54px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(260px, 360px) minmax(240px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  border-bottom: 1px solid #cbd5d0;
  background: rgba(255,255,255,.98);
  box-shadow: 0 2px 7px rgba(22,39,31,.07);
}
.sorting-view-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 4px;
  background: #e9eeeb;
}
.sorting-view-tabs button {
  min-height: 33px;
  padding: 4px 14px;
  border: 0;
  border-radius: 3px;
  background: #fff;
  color: #0f6b59;
  box-shadow: 0 1px 4px rgba(27,50,40,.18);
  font-weight: 750;
}
.sorting-inline-input {
  height: 39px;
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0,1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 2px solid #1b7965;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15,107,89,.08);
}
.sorting-scan-icon { display: grid; place-items: center; color: #0f6b59; }
.sorting-scan-icon svg { width: 17px; height: 17px; }
.sorting-inline-input input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 7px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #17211d;
  font-size: 16px;
  font-weight: 650;
}
.sorting-scan-hint { padding: 0 9px; color: #77847e; font-size: 11px; white-space: nowrap; }
.sorting-order-panel-search {
  height: 39px;
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid #b8c9c1;
  border-radius: 5px;
  background: #fff;
}
.sorting-order-panel-search:focus-within { border-color: #1b7965; box-shadow: 0 0 0 3px rgba(15,107,89,.10); }
.sorting-order-panel-search > svg { width: 16px; height: 16px; margin-left: 7px; color: #4f7668; }
.sorting-order-panel-search input { width: 100%; min-width: 0; height: 100%; padding: 0 7px; border: 0; outline: 0; background: transparent; color: #17211d; font-size: 14px; }
.sorting-order-panel-search input:disabled { cursor: not-allowed; color: #9aa8a2; }
.sorting-order-panel-search small { min-width: 0; padding-right: 8px; color: #4c7566; font-size: 11px; font-weight: 700; white-space: nowrap; }
.sorting-toolbar-actions {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
}
.sorting-user-name {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 150px;
  padding: 0 5px;
  color: #40524a;
  font-size: 11px;
  white-space: nowrap;
}
.sorting-user-name span { overflow: hidden; text-overflow: ellipsis; }
.sorting-user-name svg { width: 15px; height: 15px; flex: 0 0 auto; color: #0f6b59; }
.sorting-toolbar-actions > button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid #bac8c1;
  border-radius: 4px;
  background: #f7f9f8;
  color: #3f5149;
  font-weight: 650;
  cursor: pointer;
}
.sorting-toolbar-actions > button:hover,
.sorting-toolbar-actions > button:focus-visible { border-color: #79a897; background: #edf7f3; color: #0f6b59; outline: none; }
.sorting-toolbar-actions > button.is-active { border-color: #0f6b59; background: #dff1eb; color: #0f6b59; }
.sorting-toolbar-actions > button svg { width: 15px; height: 15px; }
.sorting-toolbar-actions > button { white-space: nowrap; }
.sorting-toolbar-actions .sorting-mobile-model-toggle { display: inline-flex; }
.sorting-toolbar-actions .sorting-settings-panel {
  position: absolute;
  top: 42px;
  right: 0;
  z-index: 160;
}
.sorting-settings-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sorting-settings-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #c8d4ce;
  border-radius: 4px;
  background: #f7f9f8;
  color: #4a5b53;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.sorting-settings-close:hover { border-color: #79a897; background: #edf7f3; color: #0f6b59; }
.sorting-work-view {
  min-height: 0;
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  gap: 8px;
  padding: 8px 12px 8px 8px;
  overflow: hidden;
}
.sorting-left-panel {
  width: 230px;
  flex-basis: 230px;
  padding: 10px 8px;
  border: 1px solid #ccd6d1;
  border-radius: 0;
  background: #f7f9f8;
}
.sorting-left-panel.is-collapsed { width: 36px; flex-basis: 36px; padding: 8px 3px; }
.sorting-panel-head {
  min-height: 33px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 0 4px;
}
.sorting-panel-head b { font-size: 14px; }
.sorting-panel-head > span { min-width: 24px; padding: 2px 6px; border-radius: 10px; background: #dfe8e3; color: #53645c; font-size: 10px; text-align: center; }
.sorting-panel-toggle {
  width: 26px;
  height: 28px;
  flex: 0 0 26px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid #bac8c1;
  border-radius: 4px;
  background: #fff;
  color: #3f5149;
}
.sorting-panel-toggle:hover { border-color: #79a897; background: #edf7f3; color: #0f6b59; }
.sorting-left-panel.is-collapsed .sorting-panel-head { justify-content: center; padding: 0; }
.sorting-left-panel.is-collapsed .sorting-panel-head > b,
.sorting-left-panel.is-collapsed .sorting-panel-head > span,
.sorting-left-panel.is-collapsed #sortingOrderSearch,
.sorting-left-panel.is-collapsed #sortingOrderList,
.sorting-left-panel.is-collapsed #sortingScanLog { display: none; }
#sortingOrderSearch {
  width: 100%;
  height: 34px;
  margin: 4px 0 8px;
  padding: 4px 9px;
  border: 1px solid #bfccc6;
  border-radius: 4px;
  outline: none;
  background: #fff;
}
#sortingOrderSearch:focus { border-color: #0f6b59; box-shadow: 0 0 0 2px rgba(15,107,89,.12); }
.sorting-left-panel #sortingOrderList { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.sorting-order-card {
  min-height: 64px;
  margin-bottom: 5px;
  padding: 7px 8px;
  border: 1px solid #d0dad5;
  border-left: 4px solid #9aa8a1;
  border-radius: 4px;
  background: #fff;
  box-shadow: none;
}
.sorting-order-card:hover { border-color: #83aa9d; }
.sorting-order-card.is-progress { border-left-color: #d57a08; background: #fffaf0; }
.sorting-order-card.is-complete { border-left-color: #0f6b59; background: #eff8f5; }
.sorting-order-card.is-current { border-color: #0f6b59; box-shadow: inset 0 0 0 1px #0f6b59; }
.sorting-order-card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sorting-order-card-subtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sorting-order-card-stats { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sorting-order-card-title { min-width: 0; display: flex; align-items: center; gap: 5px; }
.sorting-order-no { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sorting-order-priority { flex: 0 0 auto; padding: 2px 5px; border-radius: 3px; color: #a43232; background: #fff0f0; font-size: 10px; font-style: normal; font-weight: 800; }
.sorting-order-card-delivery { min-width: 0; overflow: hidden; color: #53685f; font-size: 11px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.sorting-order-card-delivery.is-warning { color: #9a5b00; font-weight: 700; }
.sorting-order-card-delivery.is-danger { color: #bd3636; font-weight: 700; }
.sorting-order-card-delivery.is-muted { color: #7a8882; }
.sorting-order-card-progress { height: 4px; margin-top: 5px; overflow: hidden; border-radius: 2px; background: #dde4e0; }
.sorting-order-card-progress > div { height: 100%; background: #0f6b59; }
.sorting-workspace {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto !important;
}
.sorting-page .sorting-current-order-bar {
  min-height: 65px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border: 1px solid #075d4c;
  border-left-width: 6px;
  border-radius: 5px;
  background: #0f6b59;
  color: #fff;
  box-shadow: 0 3px 10px rgba(9,72,58,.18);
}
.sorting-current-order-no { flex: 0 0 auto; font-size: 18px; font-weight: 750; }
.sorting-current-project { min-width: 0; overflow: hidden; color: rgba(255,255,255,.88); text-overflow: ellipsis; white-space: nowrap; }
.sorting-current-count { margin-left: auto; white-space: nowrap; opacity: .9; }
.sorting-current-progress { white-space: nowrap; font-variant-numeric: tabular-nums; color: #dfffe9; }
.sorting-current-order-bar .sorting-group-open,
.sorting-current-order-bar .sorting-order-actions-toggle { min-height: 32px; padding: 4px 9px; border: 1px solid rgba(255,255,255,.45); border-radius: 4px; background: rgba(255,255,255,.12); color: #fff; font-weight: 650; }
.sorting-current-order-bar .sorting-group-open:hover,
.sorting-current-order-bar .sorting-order-actions-toggle:hover { background: rgba(255,255,255,.22); }
.sorting-order-actions { position: relative; flex: 0 0 auto; }
.sorting-page #sortingGrid { flex: 0 0 auto; }
.sorting-page #sortingPreview { flex: 0 0 auto; }
.sorting-page .sorting-settings-panel { z-index: 160; }

@media (max-width: 900px) {
  .sorting-command-bar { grid-template-columns: auto minmax(200px,1fr) minmax(180px,1fr) auto; }
  .sorting-toolbar-actions { gap: 3px; }
  .sorting-user-name span { display: none; }
  .sorting-toolbar-actions > button span { display: none; }
  .sorting-toolbar-actions > button { min-width: 32px; padding: 4px 7px; }
  .sorting-scan-hint { display: none; }
}
@media (max-width: 768px) {
  .sorting-page { height: 100dvh; }
  .sorting-command-bar { min-height: 140px; grid-template-columns: 1fr auto; gap: 5px; padding: 5px; }
  .sorting-view-tabs { grid-column: 1; }
  .sorting-view-tabs button { min-height: 31px; padding-inline: 10px; font-size: 11px; }
  .sorting-inline-input { grid-column: 1 / -1; grid-row: 2; height: 42px; }
  .sorting-inline-input input { font-size: 15px; }
  .sorting-order-panel-search { grid-column: 1 / -1; grid-row: 3; height: 38px; }
  .sorting-toolbar-actions { grid-column: 2; grid-row: 1; }
  .sorting-work-view { display: flex; flex-direction: column; gap: 4px; padding: 4px; overflow-y: auto; }
  .sorting-page .sorting-left-panel,
  .sorting-page .sorting-left-panel:not(.is-collapsed) { position: static; inset: auto; z-index: auto; width: 100%; min-height: 132px; height: 132px; flex: 0 0 132px; padding: 4px; border-right: 0; border-bottom: 1px solid #ccd6d1; box-shadow: none; }
  .sorting-page .sorting-left-panel.is-collapsed { position: static; width: 100%; min-height: 32px; height: 32px; flex-basis: 32px; padding: 2px 4px; }
  .sorting-panel-head { min-height: 25px; }
  #sortingOrderSearch { height: 30px; margin: 1px 0 4px; }
  .sorting-left-panel #sortingOrderList { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; }
  .sorting-left-panel #sortingOrderList > div:not(.sorting-order-section-title) { display: flex; gap: 4px; flex: 0 0 auto; }
  .sorting-order-section-title { min-width: 62px; flex: 0 0 62px; justify-content: center; text-align: center; white-space: nowrap; }
  .sorting-order-card { min-width: 188px; height: 80px; margin: 0; flex: 0 0 188px; }
  .sorting-workspace { min-height: 0; overflow: visible !important; }
  .sorting-page .sorting-current-order-bar { min-height: 57px; padding: 5px 8px; gap: 6px; }
  .sorting-current-order-no { font-size: 15px; }
  .sorting-current-count, .sorting-current-progress { font-size: 11px; }
  .sorting-current-project { display: none; }
  .sorting-mobile-model-toggle { display: inline-flex !important; min-width: 34px !important; padding: 2px 5px !important; }
  .sorting-mobile-model-toggle.is-active { border-color: #0f6b59 !important; background: #dff1eb !important; color: #0f6b59 !important; }
  .sorting-page .sorting-settings-panel { position: fixed; inset: 4px; width: auto !important; max-height: calc(100dvh - 8px); overflow-y: auto; }
}
/* Desktop reminder-center viewport: keep the editor inside the system workbench. */
#systemReminderCenterHost {
  min-width: 0;
  min-height: 0;
  flex: 1 1 0;
  overflow: hidden;
}
#systemReminderCenterHost .reminder-center {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 7px;
}
#systemReminderCenterHost .reminder-center-layout {
  min-height: 0;
  overflow: hidden;
}
#systemReminderCenterHost .reminder-rule-list,
#systemReminderCenterHost .reminder-editor-host {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#systemReminderCenterHost .reminder-hit-log {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#systemReminderCenterHost .reminder-hit-log > .factory-table-scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
}
