* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #2f855a;
  --primary-dark: #276749;
  --bg: #f5f7f6;
  --border: #e2e8f0;
  --text: #1a202c;
  --muted: #718096;
  --danger: #e53e3e;
  --warning: #dd6b20;
}
body {
  font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}

/* 登录 */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2f855a 0%, #276749 100%);
}
.login-box {
  background: #fff; padding: 40px; border-radius: 12px; width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); text-align: center;
}
.login-box h1 { font-size: 20px; margin-bottom: 6px; }
.login-sub { color: var(--muted); margin-bottom: 24px; }
.login-box input {
  width: 100%; padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 15px;
}
.login-box button { width: 100%; }
.msg { margin-top: 12px; color: var(--danger); min-height: 20px; }

/* 布局 */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; background: #1f2d27; color: #cbd5d0; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 20px 18px; font-size: 16px; color: #fff; font-weight: 600; border-bottom: 1px solid rgba(255,255,255,.08); }
#nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-item {
  display: block; width: 100%; text-align: left; padding: 12px 20px; border: none;
  background: none; color: #cbd5d0; cursor: pointer; font-size: 14px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.user-info {
  padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.content { flex: 1; padding: 24px 28px; max-width: 1200px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h2 { font-size: 20px; }
#page-actions { display: flex; gap: 8px; }

/* 通用组件 */
.card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.btn {
  background: var(--primary); color: #fff; border: none; padding: 10px 18px; border-radius: 8px;
  cursor: pointer; font-size: 14px;
}
.btn:hover { background: var(--primary-dark); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: #f0fff4; }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: #fff5f5; }
.btn-gray { background: #edf2f7; color: var(--text); }
.btn-gray:hover { background: #e2e8f0; }

input, select, textarea {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #fafbfc; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #fafcfa; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar label { color: var(--muted); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.badge-gray { background: #edf2f7; color: #4a5568; }
.badge-yellow { background: #fefcbf; color: #975a16; }
.badge-green { background: #c6f6d5; color: #276749; }
.badge-blue { background: #bee3f8; color: #2c5282; }
.badge-red { background: #fed7d7; color: #9b2c2c; }
.badge-orange { background: #feebc8; color: #9c4221; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex;
  align-items: center; justify-content: center; z-index: 100;
}
.modal { background: #fff; border-radius: 12px; width: 520px; max-width: 94vw; max-height: 90vh; overflow: auto; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.form-row { display: flex; gap: 12px; margin-bottom: 14px; align-items: center; }
.form-row label { width: 90px; color: var(--muted); flex-shrink: 0; }
.form-row input, .form-row select, .form-row textarea { flex: 1; }

/* 分单 */
.modal-wide { width: 640px; }
.split-group { margin-bottom: 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.split-group-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: #f7fafc; border-bottom: 1px solid var(--border); }
.split-group-title { font-weight: 700; color: #2d3748; white-space: nowrap; }
.split-bulk { flex: 1; min-width: 0; }
.split-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px dashed var(--border); }
.split-item:last-child { border-bottom: none; }
.split-item .gname { width: 140px; font-weight: 600; }
.split-item .qty { width: 90px; color: var(--muted); }
.split-item select { flex: 1; }
.split-item select:disabled { background: #edf2f7; color: #718096; }
.quoted-tag { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 4px; background: #feebc8; color: #c05621; font-size: 11px; font-weight: 500; }
.status-tag { display: flex; gap: 8px; align-items: center; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .lbl { color: var(--muted); margin-top: 4px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt { margin-top: 12px; }
.hidden { display: none; }
.sec-title { font-weight: 600; color: #4a5568; margin: 12px 0 6px; font-size: 14px; }
.group-title { font-size: 16px; margin: 8px 0 12px; }
.cb-group { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; max-height: 180px; overflow: auto; }
.cb { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; background: #f7fafc; border-radius: 6px; font-size: 13px; cursor: pointer; }
.goods-search { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.goods-search input { flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 14px; box-sizing: border-box; }
.dup-toggle { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #4a5568; white-space: nowrap; cursor: pointer; }
.dup-badge { background: #e53e3e; color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle; }
.g-check { width: 18px; height: 18px; margin-right: 12px; flex-shrink: 0; cursor: pointer; }
.cat-check { width: 18px; height: 18px; margin-right: 10px; flex-shrink: 0; cursor: pointer; }
.batch-bar { position: sticky; top: 0; z-index: 5; background: #fff; border: 1px solid #e2e8f0; padding: 12px 16px; display: flex; align-items: center; gap: 10px; border-radius: 12px; margin-bottom: 12px; }
#batch-toggle.active { background: #2f855a; color: #fff; border-color: #2f855a; }
.recon-form { max-width: 520px; }
.rc-total { text-align: right; padding: 12px 16px; font-size: 16px; border-top: 1px solid #e2e8f0; margin-top: 8px; }
.rc-total strong { color: #2f855a; font-size: 18px; }
.remark-tag { color: #dd6b20; font-size: 12px; font-weight: 500; }
.cat-card { margin-bottom: 16px; }
.cat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; cursor: pointer; user-select: none; }
.cat-arrow { font-size: 12px; color: #2f855a; width: 16px; }
.cat-name { font-size: 16px; font-weight: 600; }
.cat-body { display: flex; flex-direction: column; }
.goods-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-top: 1px solid #f0f4f8; }
.goods-row:first-child { border-top: none; }
.goods-row.off { opacity: 0.5; }
.g-main { flex: 1; min-width: 0; }
.g-name { font-size: 15px; font-weight: 500; }
.g-spec { color: #a0aec0; font-size: 13px; font-weight: 400; }
.g-sub { font-size: 12px; color: #a0aec0; margin-top: 2px; }
.g-actions { flex-shrink: 0; display: flex; gap: 6px; margin-left: 12px; }

/* 退换货标记 */
.tag-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag-return { background: #fed7d7; color: #9b2c2c; }
.tag-exchange { background: #bee3f8; color: #2b6cb0; }
.row-return td { background: #fff5f5; }
.row-exchange td { background: #ebf8ff; }
.reason-link { color: #2b6cb0; text-decoration: underline; cursor: pointer; }

.fixed-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: #e9d8fd; color: #553c9a; font-size: 11px; font-weight: 600; vertical-align: middle; }

.row-self td { background: #f0fff4; }
.tag-self { background: #c6f6d5; color: #22543d; }
