/* ==========================================================================
   奥博橡塑工单管理 · 设计系统
   ========================================================================== */

:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e3e8ef;
  --border-strong: #cbd5e1;

  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;

  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  /* 顶栏当前项的蓝底：偏浅的蓝，压在深色底上更透气 */
  --nav-active: rgba(96, 165, 250, 0.34);
  --nav-active-hover: rgba(96, 165, 250, 0.48);

  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #ea580c;
  --warn-soft: #fff7ed;
  --ok: #16a34a;
  --ok-soft: #f0fdf4;
  --violet: #7c3aed;
  --violet-soft: #f5f3ff;
  --slate-soft: #f1f5f9;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- 顶部导航 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #0f172a;
  color: #e2e8f0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow-md);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f59e0b;
  display: block;
  object-fit: contain;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.nav { display: flex; align-items: center; gap: 4px; flex: 1; }

.nav a {
  display: block;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  color: #e8edf5;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  text-align: center;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.22); color: #fff; text-decoration: none; }
.nav a.active { background: var(--nav-active); color: #fff; }
.nav a.active:hover { background: var(--nav-active-hover); }

.topbar-meta { font-size: 14.5px; color: #b6c2d4; white-space: nowrap; }

/* ---------------------------------------------------------------- 页面骨架 */

.shell { max-width: 1440px; margin: 0 auto; padding: 24px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.2px; }
.page-desc { margin: 4px 0 0; color: var(--text-2); font-size: 13px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* 记录保留提示条：业务列表页「完成」后记录只保留最近 1 个月 */
.retention-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin: -6px 0 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.5;
}
.retention-note .retention-badge {
  flex: 0 0 auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
}

/* ---------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.35); }
.btn-primary:hover { background: var(--primary-dark); }

.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-warn { background: var(--warn); color: #fff; }
.btn-warn:hover { background: #c2410c; }

.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: #15803d; }

.btn-dark { background: #0f172a; color: #fff; }
.btn-dark:hover { background: #1e293b; }

.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: var(--radius-xs); }
.btn-lg { height: 42px; padding: 0 22px; font-size: 14.5px; }
.btn-block { width: 100%; }

/* 发货管理：两个状态切换按钮（当前态高亮置灰，另一态可点） */
.ship-toggle-form { display: inline-flex; gap: 4px; align-items: center; }
.ship-toggle-form button:disabled {
  opacity: 1;
  cursor: default;
  box-shadow: none;
}
.ship-toggle-form button:disabled.btn-warn,
.ship-toggle-form button:disabled.btn-primary { filter: none; }

/* ---------------------------------------------------------------- 卡片 */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-title { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title .count { font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--surface-3); padding: 1px 8px; border-radius: 20px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ---------------------------------------------------------------- 统计卡 */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 17px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--border-strong);
}
.stat.is-primary::after { background: var(--primary); }
.stat.is-warn::after { background: var(--warn); }
.stat.is-danger::after { background: var(--danger); }
.stat.is-ok::after { background: var(--ok); }
.stat.is-violet::after { background: var(--violet); }

.stat-label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-value.is-danger { color: var(--danger); }
.stat-value.is-warn { color: var(--warn); }
.stat-value.is-ok { color: var(--ok); }
.stat-value.is-primary { color: var(--primary); }
.stat-foot { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---------------------------------------------------------------- 筛选栏 */

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  border: 1px solid transparent;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background 0.15s, color 0.15s;
}
.tab:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.tab.active { background: var(--primary-soft); color: var(--primary-dark); border-color: #bfdbfe; }
.tab .n {
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.07);
  padding: 0 6px;
  border-radius: 20px;
  font-variant-numeric: tabular-nums;
}
.tab.active .n { background: #dbeafe; color: var(--primary-dark); }

.search-form { display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- 表单 */

.field { margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field-label .req { color: var(--danger); margin-left: 3px; }
.field-help { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.field-error { font-size: 12.5px; color: var(--danger); margin-top: 5px; font-weight: 500; }

.input, .select, .textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.input { height: 38px; }
.select { height: 38px; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.textarea { resize: vertical; min-height: 76px; line-height: 1.55; }

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}
.input::placeholder, .textarea::placeholder { color: #b6c0cd; }
.input.has-error, .select.has-error, .textarea.has-error { border-color: var(--danger); }
.input.has-error:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.13); }

.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 18px; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

.form-section + .form-section { margin-top: 8px; }
.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.2px;
  margin: 4px 0 16px;
}
.form-section-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--primary);
}
.form-section-title .hint { font-size: 12px; font-weight: 400; color: var(--text-3); }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
  flex-wrap: wrap;
}

/* ------------------------------------------------- 产品明细行（formset） */

.item-rows { display: flex; flex-direction: column; gap: 12px; }

.item-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 13px 16px 2px;
}

.item-row-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}
.item-row-title { font-size: 13.5px; font-weight: 600; flex: 1; min-width: 0; }
.item-remove {
  flex: 0 0 auto;
  padding: 3px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-family: inherit;
  line-height: 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.item-remove:hover { background: var(--danger-soft); border-color: #fca5a5; color: var(--danger); }
.item-delete-input { display: none; }
.item-row.is-removed { display: none; }

.item-add-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px 2px;
  border-top: 1px dashed var(--border);
  margin-top: 16px;
}
.item-add-hint { font-size: 12.5px; color: var(--text-3); }

/* ---------------------------------------------------------------- 表格 */

.table-wrap { overflow-x: auto; }

table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

table.table th {
  text-align: left;
  padding: 11px 14px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
table.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.table tbody tr:last-child td { border-bottom: none; }
table.table tbody tr:hover { background: var(--surface-2); }
table.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.table .nowrap { white-space: nowrap; }
/* 操作列：表头为右对齐，按钮同样右对齐，二者落在同一条竖线上 */
.cell-actions { display: flex; gap: 6px; white-space: nowrap; justify-content: flex-end; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* 发货核对单：逐条打勾 */
.pick-table td,
.pick-table th { padding: 9px 10px; }
.pick-table .pick-box {
  font-size: 20px;
  line-height: 1;
  text-align: center;
  color: var(--text-2);
  width: 44px;
  vertical-align: middle;
}
.pick-table .seq-cell {
  width: 44px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
  font-weight: 600;
  vertical-align: middle;
}
.pick-table .spec-cell { font-size: 13px; }
.pick-table .item-remark-row td {
  border-top: none;
  padding-top: 2px;
  padding-bottom: 10px;
}

/* ---------------------------------------------------------------- 徽标 */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge-pending { background: var(--warn-soft); color: #b45309; }
.badge-dispatched { background: var(--primary-soft); color: var(--primary-dark); }
.badge-processing { background: var(--violet-soft); color: #6d28d9; }
.badge-unhandled { background: #fff7ed; color: #c2410c; }
.badge-pending_handle { background: var(--warn-soft); color: #b45309; }
.badge-completed { background: var(--ok-soft); color: #15803d; }
.badge-cancelled { background: var(--surface-3); color: #64748b; }
.badge-arrived { background: var(--ok-soft); color: #15803d; }

.badge-overdue { background: var(--danger-soft); color: var(--danger); }
.badge-urgent { background: var(--warn-soft); color: var(--warn); }
.badge-soon { background: var(--primary-soft); color: var(--primary-dark); }
.badge-normal { background: var(--surface-3); color: #64748b; }
.badge-done { background: var(--surface-3); color: var(--text-3); }

.badge-idle { background: var(--ok-soft); color: #15803d; }
.badge-running { background: var(--violet-soft); color: #6d28d9; }
.badge-maintenance { background: var(--warn-soft); color: var(--warn); }
.badge-offline { background: var(--surface-3); color: #64748b; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
}

/* ---------------------------------------------------------------- 工单看板卡片 */

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(372px, 1fr));
  gap: 14px;
  align-items: start; /* 卡片按自身内容高度撑开，不互相拉伸 */
}

.wo-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 12px 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}
.wo-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--border-strong);
}
.wo-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--border-strong); }

.wo-card.p-overdue { background: linear-gradient(180deg, #fffafa 0%, #fff 42%); }
.wo-card.p-overdue::before { background: var(--danger); }
.wo-card.p-urgent { background: linear-gradient(180deg, #fffdf8 0%, #fff 42%); }
.wo-card.p-urgent::before { background: var(--warn); }
.wo-card.p-soon::before { background: var(--primary); }
.wo-card.p-normal::before { background: #94a3b8; }
.wo-card.p-done { opacity: 0.72; }
.wo-card.p-done::before { background: #cbd5e1; }

.wo-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.wo-no {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.3px;
}

.wo-product { font-size: 15.5px; font-weight: 700; line-height: 1.35; }
.wo-spec { font-size: 12.5px; color: var(--text-2); display: flex; gap: 6px; align-items: flex-start; }
.wo-spec .k { color: var(--text-3); flex: 0 0 42px; }

/* 多规格清单：逐条展示，完整换行不截断 */
.spec-list { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.spec-line {
  display: flex;
  gap: 8px;
  min-width: 0;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.spec-line::before {
  content: "";
  flex: 0 0 4px;
  width: 4px;
  height: 4px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--primary);
}

/* 看板产品明细区：一张工单可含多个产品 */
.wo-products {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 11px 9px;
}
.wo-products-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.wo-products-head .n {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
  border-radius: 20px;
  padding: 0 7px;
  font-size: 11px;
  line-height: 16px;
}

.item-list { display: flex; flex-direction: column; gap: 9px; }
.item-block + .item-block { padding-top: 9px; border-top: 1px dashed var(--border); }

.item-head { display: flex; align-items: baseline; gap: 7px; }
.item-seq {
  flex: 0 0 auto;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  position: relative;
  top: 1px;
}
.item-name { font-size: 13px; font-weight: 700; min-width: 0; word-break: break-word; }
.item-qty {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.item-block .spec-list { margin-top: 5px; padding-left: 23px; }
.item-block .spec-line { font-size: 12.5px; color: var(--text-2); }
.item-remark {
  margin: 5px 0 0 23px;
  font-size: 11.5px;
  color: var(--text-2);
  border-left: 2px solid var(--border-strong);
  padding-left: 8px;
  word-break: break-word;
}

/* 通用折叠：默认只显示前 N 条，展开后全部显示 */
.collapse-list:not(.is-expanded) > .collapse-hidden { display: none; }

.collapse-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  padding: 2px 9px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  line-height: 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.collapse-toggle:hover { background: var(--primary-soft); border-color: #bfdbfe; color: var(--primary-dark); }
.collapse-toggle-caret {
  font-size: 9px;
  line-height: 1;
  display: inline-block;
  transition: transform 0.18s;
}
.collapse-toggle.is-expanded .collapse-toggle-caret { transform: rotate(180deg); }

/* 整卡级别的展开按钮：通栏，与规格级按钮区分 */
.collapse-toggle.is-wide {
  display: flex;
  width: 100%;
  justify-content: center;
  border-style: solid;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-2);
  margin-top: 9px;
  padding: 3px 9px;
}
.collapse-toggle.is-wide:hover { background: var(--primary-soft); border-color: #bfdbfe; color: var(--primary-dark); }

/* 记录页年/月归档折叠：年份仅作视觉分组标题（不可折叠），折叠交互在月份这一级 */
.year-group { margin-bottom: 18px; }
.year-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  user-select: none;
}
.year-group-title { font-size: 15px; font-weight: 700; color: var(--text); }
.year-group-count { font-size: 12px; color: var(--text-3); margin-left: auto; }
.year-group-caret {
  font-size: 10px;
  color: var(--text-3);
  transition: transform 0.18s;
  flex: 0 0 auto;
}

.month-group { margin: 10px 0 0 4px; }
.month-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.month-group-title:hover { background: var(--surface-3); }
.month-group.is-collapsed .year-group-caret { transform: rotate(-90deg); }
.month-group.is-collapsed .month-group-body { display: none; }
.month-group .card { margin: 0; }
.month-group-body { margin-top: 6px; }
.month-group-body .record-done-list { margin: 0; }

/* 详情页规格清单 */
.spec-sheet { display: flex; flex-direction: column; gap: 6px; }
.spec-sheet .spec-line { font-size: 13.5px; font-weight: 600; }
.spec-sheet .spec-line::before { width: 5px; height: 5px; flex: 0 0 5px; margin-top: 8px; }

/* ------------------------------------------------ 产品行生产状态（三段切换） */

.seg {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  flex: 0 0 auto;
}
.seg form { margin: 0; display: flex; }
.seg button {
  border: none;
  background: transparent;
  padding: 3px 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-2);
  line-height: 18px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seg form + form button { border-left: 1px solid var(--border); }
.seg button:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.seg button.is-on { font-weight: 600; cursor: default; }
.seg button.is-on.is-todo { background: var(--surface-3); color: var(--text-2); }
.seg button.is-on.is-doing { background: var(--violet-soft); color: #6d28d9; }
.seg button.is-on.is-done { background: var(--ok-soft); color: #15803d; }

/* 已完成生产的产品行：整体弱化 */
.item-block.is-done .item-name { color: var(--text-2); }
.item-block.is-done .item-seq { background: var(--ok-soft); color: #15803d; }

.badge-item-todo { background: var(--surface-3); color: var(--text-2); }
.badge-item-doing { background: var(--violet-soft); color: #6d28d9; }
.badge-item-done { background: var(--ok-soft); color: #15803d; }

.ok-text { color: var(--ok); font-weight: 600; }

/* 表格内规格清单 */
.spec-list-cell { min-width: 170px; max-width: 250px; }
.spec-list-cell .spec-line { font-size: 12.5px; color: var(--text-2); }
.spec-list-cell .spec-line::before { width: 3px; height: 3px; flex: 0 0 3px; margin-top: 8px; background: var(--border-strong); }

/* 表格内多产品清单 */
.item-list-cell { display: flex; flex-direction: column; gap: 7px; min-width: 210px; max-width: 300px; }
.item-list-cell .item-block + .item-block { padding-top: 7px; }
.item-list-cell .item-name { font-size: 12.5px; }
.item-list-cell .item-qty { font-size: 11.5px; }
.item-list-cell .item-head { align-items: center; }
.item-list-cell .spec-list { margin-top: 3px; padding-left: 0; }
.item-list-cell .spec-line { font-size: 11.5px; color: var(--text-3); }
.item-list-cell .spec-line::before { width: 3px; height: 3px; flex: 0 0 3px; margin-top: 7px; }

/* 产品明细折叠：默认只显示 2 个产品，点按钮展开全部，减少屏幕占用 */
.item-list-cell.is-collapsed .item-block.is-extra { display: none; }
.item-expand {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
  padding: 2px 8px;
  font-size: 11.5px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.4;
}
.item-expand:hover { background: #dbeafe; }
.item-expand.is-open .item-expand-arrow { transform: rotate(180deg); }

.wo-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  padding: 10px 0 0;
  border-top: 1px dashed var(--border);
}
.wo-meta-item { min-width: 0; }
.wo-meta-k { font-size: 11.5px; color: var(--text-3); }
.wo-meta-v { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wo-meta-v.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; }
.wo-meta-v.danger { color: var(--danger); }
.wo-meta-v.warn { color: var(--warn); }
.wo-meta-v.ok { color: var(--ok); }

.wo-remark {
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border-left: 2px solid var(--border-strong);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  padding: 6px 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wo-remark .k { color: var(--text-3); }

.wo-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.wo-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.wo-actions { display: flex; gap: 6px; }

/* 交货期进度条 */
.due-bar { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; display: flex; }
.due-bar span { height: 100%; border-radius: 4px; background: var(--primary); }
.due-bar.is-danger span { background: var(--danger); }
.due-bar.is-warn span { background: var(--warn); }
.due-bar.is-ok span { background: var(--ok); }

/* ---------------------------------------------------------------- 详情页 */

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }

.dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; }
.dl-item { padding: 13px 18px; border-bottom: 1px solid var(--border); min-width: 0; }
.dl-item:nth-child(odd) { border-right: 1px solid var(--border); }
.dl-k { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.dl-v { font-size: 14.5px; font-weight: 600; word-break: break-word; }
.dl-v.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.dl-full { grid-column: 1 / -1; border-right: none !important; }

/* ---------------------------------------------------------------- 时间线 */

.timeline { list-style: none; margin: 0; padding: 4px 0 4px 4px; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--border); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
}
.timeline li.is-done::before { background: var(--ok); border-color: var(--ok); }
.timeline li.is-active::before { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16); }
.tl-title { font-size: 13.5px; font-weight: 600; }
.tl-time { font-size: 12px; color: var(--text-3); }

/* ---------------------------------------------------------------- 提示/空态 */

.messages { position: fixed; top: 74px; right: 24px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  animation: slide-in 0.25s ease;
}
.alert-icon { flex: 0 0 auto; font-weight: 700; }
.alert-success { border-left-color: var(--ok); background: #f6fef9; }
.alert-success .alert-icon { color: var(--ok); }
.alert-danger { border-left-color: var(--danger); background: #fffafa; }
.alert-danger .alert-icon { color: var(--danger); }
.alert-warning { border-left-color: var(--warn); background: #fffdf8; }
.alert-warning .alert-icon { color: var(--warn); }
.alert-info { border-left-color: var(--primary); background: #f8fbff; }
.alert-info .alert-icon { color: var(--primary); }

@keyframes slide-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

.empty { padding: 56px 20px; text-align: center; color: var(--text-3); }
.empty-icon { font-size: 34px; line-height: 1; margin-bottom: 10px; opacity: 0.55; }
.empty-title { font-size: 14.5px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.empty-desc { font-size: 13px; margin-bottom: 16px; }

.card-body > .empty { padding: 40px 20px; }

/* ---------------------------------------------------------------- 后台管理 */

.manage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }

.manage-tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  color: var(--text);
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}
.manage-tile:hover { text-decoration: none; box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: #bfdbfe; }
.manage-tile .icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  font-size: 18px; background: var(--primary-soft); color: var(--primary-dark); margin-bottom: 12px;
}
.manage-tile .icon.violet { background: var(--violet-soft); color: #6d28d9; }
.manage-tile .icon.ok { background: var(--ok-soft); color: #15803d; }
.manage-tile h3 { margin: 0 0 4px; font-size: 15.5px; }
.manage-tile p { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.manage-tile .go { margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--primary); }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.mini-list li:last-child { border-bottom: none; }
.mini-list .name { font-weight: 600; }
.mini-list .sub { font-size: 12px; color: var(--text-3); }

/* ---------------------------------------------------------------- 其他 */

.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gap-2 { gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.section-label {
  font-size: 12px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.6px; margin: 0 0 10px;
}

.countdown-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
}
.countdown-pill.overdue { background: var(--danger-soft); color: var(--danger); }
.countdown-pill.urgent { background: var(--warn-soft); color: var(--warn); }
.countdown-pill.soon { background: var(--primary-soft); color: var(--primary-dark); }
.countdown-pill.normal { background: var(--surface-3); color: #64748b; }
.countdown-pill.done { background: var(--surface-3); color: var(--text-3); }

/* ---------------------------------------------------------------- 派发明细 */

.emp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  align-items: stretch; /* 同一行卡片等高，底部按钮对齐 */
}

.emp-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}
.emp-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--border-strong);
}
.emp-card.is-overdue::before { background: var(--danger); }
.emp-card.is-busy::before { background: var(--violet); }
.emp-card.is-idle::before { background: var(--ok); }
.emp-card[data-href] { cursor: pointer; }
.emp-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--border-strong); }

.emp-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.emp-name { font-size: 15.5px; font-weight: 700; line-height: 1.3; }
.emp-sub { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-3); }

.emp-load { flex: 0 0 auto; text-align: right; }
.emp-load-n { font-size: 23px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.emp-load-k { font-size: 11.5px; color: var(--text-3); }
.emp-load.is-overdue .emp-load-n { color: var(--danger); }
.emp-load.is-busy .emp-load-n { color: var(--violet); }
.emp-load.is-idle .emp-load-n { color: var(--ok); }

.emp-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.emp-orders {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
}
.emp-order { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.emp-order-main { flex: 1; min-width: 0; }
.emp-order .countdown-pill { flex: 0 0 auto; padding: 2px 9px; font-size: 11.5px; }
.emp-order-no {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.2px;
}
.emp-order-product {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.emp-order-meta { font-size: 11.5px; color: var(--text-3); }
.emp-more { font-size: 11.5px; color: var(--text-3); }

.emp-remark {
  padding: 6px 10px;
  background: var(--surface-2);
  border-left: 2px solid var(--border-strong);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  font-size: 12px;
  color: var(--text-2);
}

.emp-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto; /* 卡片等高时按钮固定在底部 */
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ------------------------------------------------- 派单记录（按操作员汇总，可打印） */

.record-list { display: flex; flex-direction: column; gap: 14px; }

.record-card {
  position: relative;
  padding: 14px 16px 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.record-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--border-strong);
}
.record-card:has(.badge-processing)::before { background: var(--violet); }

.record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.record-op { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.record-name { font-size: 15.5px; font-weight: 700; }
.record-phone { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-3); }
.record-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.record-section-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  margin: 12px 0 8px;
  letter-spacing: 0.2px;
}

.record-table th, .record-table td { padding: 7px 12px; }

.record-empty { font-size: 13px; color: var(--text-3); padding: 10px 0 4px; }

.record-done-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.record-done-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-xs);
  font-size: 13px;
}
.record-done-list .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
}
.record-time {
  margin-left: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-3);
}

/* ------------------------------------------------- 员工生产任务单（可打印） */

.sheet-stack { display: flex; flex-direction: column; gap: 14px; }

.job-sheet {
  position: relative;
  padding: 14px 16px 0 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.job-sheet::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--border-strong);
}
.job-sheet.p-overdue::before { background: var(--danger); }
.job-sheet.p-urgent::before { background: var(--warn); }
.job-sheet.p-soon::before { background: var(--primary); }

.job-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.job-no {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.job-due { margin-left: auto; font-size: 12.5px; color: var(--text-3); }

.job-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 8px 16px;
  padding: 10px 0;
}
.job-meta-item { min-width: 0; font-size: 13px; }
.job-meta-item .k { display: block; font-size: 11.5px; color: var(--text-3); }
.job-meta-item .v { font-weight: 600; word-break: break-word; }

.job-sheet .table-wrap { margin: 0 -16px 0 -18px; }
.job-sheet .job-table th, .job-sheet .job-table td { padding: 8px 14px; }
.job-sheet .spec-line { font-size: 12.5px; }
.job-sheet .spec-line::before { width: 3px; height: 3px; flex: 0 0 3px; margin-top: 8px; }

.job-remark {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 10px;
  padding: 9px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  color: var(--text-2);
}
.job-remark .k { color: var(--text-3); }

.job-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 0 12px;
}

/* 仅在打印时出现的区块 */
.print-only { display: none; }

.print-head { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid #0f172a; }
.print-title { font-size: 17px; font-weight: 700; letter-spacing: 0.4px; }
.print-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  margin-top: 8px;
  font-size: 12px;
}
.print-meta .k { color: #475569; margin-right: 5px; }
.print-sign { margin-top: 10px; font-size: 12px; letter-spacing: 0.4px; }

@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: 1fr; }
  .col-3, .col-4, .col-6, .col-8 { grid-column: span 6; }
}

/* ---------------------------------------------------------------- 响应式 */

/* 平板竖屏及以下：顶栏改为两行（品牌一行 + 导航自动换行）。
   单行放 6 个导航项 + 品牌名 + 时间最少要 ~880px，低于这个宽度会横向溢出。 */
@media (max-width: 900px) {
  .topbar { position: static; }
  .topbar-inner {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 16px 12px;
    gap: 6px 14px;
  }
  /* flex-basis 必须为 100%：若沿用基础样式里 flex:1 的 basis:0%，
     导航仍会和品牌挤在一行（width:100% 会被 basis:0% 顶掉） */
  .nav { order: 2; flex: 0 0 100%; flex-wrap: wrap; gap: 4px; }
  .nav a { padding: 6px 12px; font-size: 13px; }
  /* 顶栏不再吸顶后，提示条放回流内，避免遮住导航 */
  .messages { position: static; margin: 12px 16px 0; max-width: none; }
}

/* 手机宽度：导航上下两行（每行 4 项，7 项即 4+3），按钮等宽、文字居中 */
@media (max-width: 720px) {
  .topbar-inner { padding: 8px 14px 12px; gap: 4px; }
  .nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    flex-direction: row;
  }
  .nav a {
    width: auto;
    text-align: center;
    white-space: nowrap;
    padding: 10px 8px;
    font-size: 13.5px;
    border-radius: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 触控目标：按钮/标签/tab 高度提到 40px 左右（WCAG 推荐 44px，兼顾密度取 40） */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; padding: 0 13px; }
  .tab { padding: 9px 13px; }
  .seg button { padding: 9px 10px; }
  .item-expand { padding: 8px 12px; }

  /* 表格操作列吸附右侧：手机上不用滑到最右也能看到操作按钮 */
  .table th:last-child,
  .table td:last-child {
    position: sticky;
    right: 0;
    background: var(--surface, #fff);
    box-shadow: -6px 0 8px -6px rgba(15, 23, 42, 0.18);
  }
  .table thead th:last-child { background: var(--surface-2, #f1f5f9); z-index: 2; }

  /* 指定表格不吸附操作列（如发货管理：按钮多、吸附会遮挡内容），操作列回到内容流末尾 */
  .table.no-sticky th:last-child,
  .table.no-sticky td:last-child {
    position: static;
    background: transparent;
    box-shadow: none;
  }
}

@media (max-width: 720px) {
  .shell { padding: 14px; }
  .topbar-meta { display: none; }
  .brand { font-size: 14px; }

  .board-grid { grid-template-columns: 1fr; }
  .emp-grid { grid-template-columns: 1fr; }
  .col-3, .col-4, .col-6, .col-8, .col-12 { grid-column: span 12; }
  .dl { grid-template-columns: 1fr; }
  .dl-item:nth-child(odd) { border-right: none; }

  /* 页头与卡片收紧留白 */
  .page-title { font-size: 19px; }
  .page-desc { font-size: 12.5px; }
  .page-head { margin-bottom: 14px; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 14px; }

  /* 统计卡固定两列，避免出现一根细条 */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
  .stat { padding: 12px 13px; }
  .stat-value { font-size: 22px; }

  /* 筛选栏：标签单行横向滑动，搜索框占满整行（覆盖模板里的行内宽度） */
  .filter-bar { padding: 8px 10px; margin-bottom: 12px; }
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .search-form { width: 100%; }
  .search-form .input { width: 100% !important; flex: 1 1 auto; }

  /* 表格：单元格收紧、顺畅横滑 */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table.table th, table.table td { padding: 8px 10px; font-size: 12.5px; }

  /* 详情页产品行：名称 + 状态按钮 + 数量放不下时整体换行 */
  .item-head { flex-wrap: wrap; row-gap: 6px; }
  .job-meta { grid-template-columns: repeat(2, 1fr); }
  .empty { padding: 40px 16px; }

  /* 表单小节标题：说明文字独占一行，标题不再被挤得逐字折行 */
  .form-section-title { flex-wrap: wrap; row-gap: 2px; }
  .form-section-title .hint { flex: 0 0 100%; }

  /* iOS 聚焦表单时会自动放大页面，输入控件字号提到 16px 可避免 */
  .input, .select, .textarea { font-size: 16px; }

  /* 发货管理移动端卡片化：隐藏表头，每张工单独立成卡，字段名左对齐，操作按钮移到信息下方 */
  .ship-card thead { display: none; }
  .ship-card tr {
    display: block;
    padding: 12px 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    background: var(--surface, #fff);
  }
  .ship-card td {
    display: block;
    padding: 4px 0;
    border: none;
    text-align: left;
    white-space: normal;
  }
  .ship-card td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 76px;
    font-size: 11.5px;
    color: var(--text-3);
    margin-right: 6px;
  }
  .ship-card .ship-actions-cell { padding-top: 10px; margin-top: 6px; border-top: 1px dashed var(--border); }
  .ship-card .ship-actions-cell::before { display: none; }
  .ship-card .ship-actions-cell .cell-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* ---------------------------------------------------------------- 打印 */

@media print {
  @page { size: A4 portrait; margin: 12mm 10mm; }

  body { background: #fff; }

  /* 所有页面通用：去掉交互件与阴影，内容铺满纸张 */
  .topbar, .messages, .page-actions, .no-print { display: none !important; }
  .shell { max-width: none; margin: 0; padding: 0; }
  .card, .job-sheet, .wo-card, .emp-card, .stat { box-shadow: none !important; }
  a { color: inherit; text-decoration: none; }
  .table-wrap { overflow: visible !important; }
  .badge, .countdown-pill, .job-table th, .spec-line::before {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-only { display: block !important; }

  /* 员工生产任务单：每张工单不跨页，压缩留白让多张任务单尽量落在同一页 */
  body.is-printable .filter-bar,
  body.is-printable .stat-grid { display: none !important; }
  body.is-printable .page-head { margin-bottom: 8px; }
  body.is-printable .page-title { font-size: 16px; }
  body.is-printable .print-head { margin-bottom: 8px; padding-bottom: 8px; }
  body.is-printable .print-sign { margin-top: 6px; }
  body.is-printable .sheet-stack { gap: 6px; }
  body.is-printable .job-sheet {
    break-inside: avoid;
    page-break-inside: avoid;
    padding: 8px 10px 4px 12px;
    border-color: #94a3b8;
  }
  body.is-printable .job-head { padding-bottom: 6px; }
  body.is-printable .job-meta { gap: 4px 14px; padding: 6px 0; }
  body.is-printable .job-remark { margin-top: 6px; padding: 6px 10px; }
  body.is-printable .job-sheet .table-wrap { margin: 0 -10px 0 -12px; }
  body.is-printable .job-table th { background: #f1f5f9 !important; }
  body.is-printable .job-table th,
  body.is-printable .job-table td { padding: 5px 10px; }
  body.is-printable .pick-table td,
  body.is-printable .pick-table th { padding: 6px 10px; }
  body.is-printable .pick-table .pick-box { font-size: 16px; }
  body.is-printable .pick-table .seq-cell { font-size: 13px; }
  body.is-printable .pick-table tr { break-inside: avoid; }
  body.is-printable .record-card {
    break-inside: avoid;
    page-break-inside: avoid;
    padding: 8px 10px 4px 12px;
    border-color: #94a3b8;
  }
  body.is-printable .record-head { padding-bottom: 6px; }
  body.is-printable .record-section-title { margin: 8px 0 6px; }
}

/* ---------------------------------------------------------------- 云服务登录页 */

body.is-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  padding: 30px 26px 24px;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 18px;
}
/* 登录页 logo 更大更醒目 */
.login-brand .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  padding: 4px;
}

.login-title { font-size: 20px; text-align: center; margin: 0 0 6px; }

.login-sub {
  font-size: 12.5px;
  color: var(--text-3);
  text-align: center;
  margin: 0 0 18px;
  line-height: 1.6;
}

.login-form { display: flex; flex-direction: column; gap: 12px; }

.login-field { display: flex; flex-direction: column; gap: 4px; }

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.5;
}

.btn-block { width: 100%; justify-content: center; }

.topbar-signout {
  margin-left: 14px;
  color: #b6c2d4;
  font-size: 13px;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  padding: 2px 10px;
  white-space: nowrap;
}
.topbar-signout:hover { color: #fff; border-color: rgba(255, 255, 255, 0.45); }

/* ---- 自定义模态框（替代 window.confirm / window.alert）---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  width: 100%;
  max-width: 380px;
  background: var(--surface, #fff);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  padding: 20px 20px 16px;
  animation: modal-pop .18s ease-out;
}
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.modal-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text, #1e293b);
  margin-bottom: 8px;
}
.modal-body {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-2, #475569);
  word-break: break-word;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.modal-actions .btn { min-width: 72px; }

