:root {
  --green: #1f9d55;
  --green-deep: #157a41;
  --bg: #f3f5f4;
  --card: #ffffff;
  --text: #1d2421;
  --muted: #8a958f;
  --line: #e8ecea;
  --ok: #1f9d55;
  --warn: #e0a200;
  --danger: #e2483c;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 40, 30, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

.view { padding: 0 14px 90px; }
.hidden { display: none; }

/* 品牌区（主界面抬头） */
.brand { text-align: center; padding: 26px 0 16px; }
.brand h1 { margin: 0; font-size: 24px; letter-spacing: 2px; font-weight: 800; }

/* 日期区（下拉） */
.date-section { margin-bottom: 16px; }
.date-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--muted); margin: 2px 2px 0;
}
.date-select {
  flex: 1; appearance: none; -webkit-appearance: none;
  padding: 11px 38px 11px 14px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 15px; color: var(--text); background: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238a958f' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  box-shadow: var(--shadow); outline: none; cursor: pointer;
}
.date-select:focus { border-color: var(--green); }

.hint { text-align: center; color: var(--muted); font-size: 13px; margin-top: 18px; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0 12px;
  background: var(--bg);
}
.icon-btn {
  border: none; background: var(--card); color: var(--text);
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 24px; line-height: 1; cursor: pointer; box-shadow: var(--shadow);
}
.topbar-title { display: flex; flex-direction: column; }
.topbar-title strong { font-size: 17px; }
.topbar-title .date { font-size: 12px; color: var(--muted); }
.source-tag {
  margin-left: auto; font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); padding: 2px 8px; border-radius: 20px;
}

/* 汇总卡 */
.summary {
  display: flex; justify-content: space-around;
  margin: 4px 0 16px;
}
.sum-item { text-align: center; flex: 1; }
.sum-num { display: block; font-size: 22px; font-weight: 700; }
.sum-num.ok { color: var(--ok); }
.sum-label { font-size: 12px; color: var(--muted); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

/* 分拣表：产品 / 数量 / 分拣数量 / 补充说明 */
.table-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sort-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.sort-table thead th {
  background: #eef2f0; color: var(--muted);
  font-weight: 600; font-size: 12px; text-align: left;
  padding: 9px 6px; white-space: nowrap;
}
.sort-table tbody td {
  padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: middle;
}
.sort-table tbody tr.done { background: rgba(31,157,85,.07); }
.sort-table tbody tr.diff { background: rgba(224,162,0,.12); }
.sort-table .col-prod { width: 30%; }
.sort-table .col-qty { width: 13%; }
.sort-table .col-act { width: 25%; }
.sort-table .col-rmk { width: 32%; }
.sort-table .pname { font-weight: 600; line-height: 1.25; word-break: break-all; }
.sort-table .spec { color: var(--muted); font-size: 11px; margin-top: 1px; }
.sort-table .plan-num { font-size: 15px; font-weight: 700; }
.sort-table input {
  width: 100%; min-width: 0; padding: 7px 7px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; background: #fafbfa; outline: none;
}
.sort-table input:focus { border-color: var(--green); background: #fff; }
.sort-table td.hint { text-align: center; color: var(--muted); padding: 22px 8px; }

.field { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.field label { font-size: 13px; color: var(--muted); width: 52px; flex: none; }
.field input {
  flex: 1; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 16px; outline: none; background: #fafbfa;
}
.field input:focus { border-color: var(--green); }
.check {
  display: flex; align-items: center; gap: 6px; margin-top: 10px;
  font-size: 14px; cursor: pointer; user-select: none;
}
.check input { width: 18px; height: 18px; accent-color: var(--green); }

/* 客户列表 / 客户卡：默认绿色底（待分拣），确认后红色底（已完成） */
.section-tip { color: var(--muted); font-size: 13px; margin: 4px 2px 12px; }
/* 客户编码网格（两列，全部铺开，长页可滚动） */
.customer-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.customer-grid .hint { grid-column: 1 / -1; }
.customer-card {
  background: #1f9d55;
  color: #fff;
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(31,157,85,.28);
  padding: 18px 12px;
  min-height: 92px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; text-align: center;
  cursor: pointer;
  transition: transform .08s ease;
}
.customer-card:active { transform: scale(.97); }
.customer-card.done { background: #e2483c; box-shadow: 0 2px 10px rgba(226,72,60,.30); }
.customer-card .cc-code-big { font-size: 20px; font-weight: 800; letter-spacing: 1px; line-height: 1.15; word-break: break-all; }
.customer-card .cc-sub { display: flex; flex-direction: column; gap: 1px; font-size: 12px; opacity: .95; }
.customer-card .cc-name { font-weight: 600; }
.customer-card .cc-prog { font-size: 11px; opacity: .9; }

/* 客户明细进度条 */
.cust-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cust-progress .bar { flex: 1; height: 8px; border-radius: 5px; background: var(--line); overflow: hidden; }
.cust-progress .bar-fill { height: 100%; width: 0; background: var(--green); border-radius: 5px; transition: width .2s ease; }
.cust-progress-text { font-size: 13px; color: var(--muted); flex: none; }

/* 分拣数量与计划数量不一致：整行高亮（见 .sort-table tr.diff） */

/* 新增产品按钮 */
.add-line-btn {
  width: 100%; padding: 12px; margin: 6px 0 12px;
  border: 1.5px dashed var(--green); border-radius: var(--radius);
  background: rgba(31,157,85,.06); color: var(--green-deep);
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.add-line-btn:active { background: rgba(31,157,85,.12); }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal.hidden { display: none; }
.modal-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 16px;
  padding: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.modal-title span { color: var(--green-deep); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .primary-btn { flex: 1; box-shadow: none; }
.ghost-btn {
  flex: 1; padding: 14px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--muted); font-size: 16px; cursor: pointer;
}
.ghost-btn:active { background: #f3f5f4; }

/* 底部提交 */
.footer-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, rgba(243,245,244,0));
}
.primary-btn {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--green); color: #fff; font-size: 16px; font-weight: 600;
  cursor: pointer; box-shadow: 0 4px 14px rgba(31,157,85,.32);
}
.primary-btn:active { background: var(--green-deep); }
.primary-btn:disabled { opacity: .55; }

/* 底部双按钮：一键分拣 / 确认 */
.footer-2 { display: flex; gap: 10px; }
.footer-2 .primary-btn { flex: 1; }
.ghost-fill-btn {
  flex: 1; padding: 14px; border: 1.5px solid var(--green); border-radius: 12px;
  background: #fff; color: var(--green-deep);
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.ghost-fill-btn:active { background: rgba(31,157,85,.08); }
.ghost-fill-btn:disabled { opacity: .55; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(29,36,33,.92); color: #fff; padding: 10px 18px;
  border-radius: 22px; font-size: 14px; z-index: 20; max-width: 80%;
}
.toast.hidden { display: none; }

/* 异常照片列 */
.col-photo { width: 84px; }
.photo-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.photo-thumb {
  width: 34px; height: 34px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line, #ddd); cursor: pointer;
}
.photo-btn {
  width: 34px; height: 34px; border: 1.5px dashed var(--green, #1f9d55);
  border-radius: 6px; background: #fff; font-size: 15px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.photo-btn:active { background: rgba(31,157,85,.1); }
.photo-btn:disabled { opacity: .5; }
.hidden { display: none !important; }

/* 页头登录人标签 */
.brand { display: flex; align-items: center; justify-content: space-between; }
.user-tag {
  font-size: 13px; color: var(--green-deep, #166534);
  background: rgba(31,157,85,.1); padding: 4px 10px; border-radius: 14px;
}
