:root {
  --primary: #1B7BF7;
  --green: #00B42A;
  --orange: #FF7D00;
  --red: #FA5151;
  --bg: #F5F7FA;
  --card: #fff;
  --text: #1F2329;
  --sub: #8A9099;
  --line: #EDEFF2;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: var(--primary); text-decoration: none; }

/* 登录 */
.login-mask { position: fixed; inset: 0; background: linear-gradient(135deg, #1B7BF7, #4E9BFF); display: flex; align-items: center; justify-content: center; z-index: 999; }
.login-box { width: 380px; background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 12px 40px rgba(0,0,0,.18); }
.login-title { font-size: 22px; font-weight: 700; text-align: center; }
.login-sub { text-align: center; color: var(--sub); margin: 6px 0 24px; font-size: 13px; }
.lb { display: block; font-size: 12px; color: var(--sub); margin: 12px 0 6px; }
.ipt { width: 100%; height: 40px; border: 1px solid #DDDFE3; border-radius: 8px; padding: 0 12px; font-size: 14px; outline: none; }
.ipt:focus { border-color: var(--primary); }
.btn-login { width: 100%; height: 44px; margin-top: 22px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
.login-tip { margin-top: 12px; font-size: 12px; color: var(--sub); text-align: center; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.side { width: 200px; background: #1F2329; color: #fff; display: flex; flex-direction: column; padding: 20px 0; flex-shrink: 0; }
.side .logo { padding: 0 20px 16px; font-size: 16px; font-weight: 700; }
.role-tag { margin: 0 16px 16px; padding: 4px 10px; background: rgba(255,255,255,.12); border-radius: 6px; font-size: 12px; display: inline-block; }
.side nav { flex: 1; }
.side nav a { display: block; padding: 12px 20px; color: rgba(255,255,255,.7); font-size: 14px; cursor: pointer; }
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.on { background: var(--primary); color: #fff; font-weight: 600; }
.side-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); }
.btn-mini { background: rgba(255,255,255,.14); color: #fff; border: none; border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; margin-top: 6px; }

.main { flex: 1; min-width: 0; }
.topbar { height: 56px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.page-title { font-size: 16px; font-weight: 600; }
.content { padding: 20px 24px 60px; }

/* 卡片 / 表格 */
.card { background: var(--card); border-radius: 12px; padding: 18px; margin-bottom: 16px; box-shadow: 0 1px 6px rgba(31,35,41,.06); }
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.kpi { display: flex; gap: 16px; flex-wrap: wrap; }
.kpi .k { flex: 1; min-width: 160px; background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 1px 6px rgba(31,35,41,.06); }
.kpi .k .v { font-size: 26px; font-weight: 700; margin-top: 6px; }
.kpi .k .l { font-size: 12px; color: var(--sub); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--sub); font-weight: 500; background: #FAFBFC; }
tr:hover td { background: #FAFBFC; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag-blue { background: #E8F1FF; color: var(--primary); }
.tag-green { background: #E8F8EE; color: var(--green); }
.tag-orange { background: #FFF3E8; color: var(--orange); }
.tag-red { background: #FFECE8; color: var(--red); }
.tag-gray { background: #F2F3F5; color: var(--sub); }
.btn { display: inline-block; padding: 6px 14px; background: var(--primary); color: #fff; border: none; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn-ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-gray { background: #F2F3F5; color: var(--sub); border: 1px solid #DDDFE3; }
.btn-danger { background: var(--red); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.t-sm { font-size: 12px; color: var(--sub); }
.empty { padding: 60px 0; text-align: center; color: var(--sub); }
.search { height: 36px; border: 1px solid #DDDFE3; border-radius: 6px; padding: 0 12px; font-size: 13px; width: 260px; }
.chart { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding-top: 12px; }
.chart .b { flex: 1; background: linear-gradient(180deg,#4E9BFF,#1B7BF7); border-radius: 4px 4px 0 0; position: relative; }
.chart .b span { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--sub); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* 水洗唛标签打印 */
.print-area { display: none; }
@media print {
  body * { display: none !important; }
  .print-area, .print-area * { display: block !important; }
  .print-area { position: static; }
  @page { size: A4; margin: 10mm; }
  .label-sheet { display: flex; flex-wrap: wrap; gap: 2mm; }
  .label {
    width: 40mm; height: 30mm; border: 1px dashed #999; padding: 1mm;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    page-break-inside: avoid; overflow: hidden;
  }
  .label .nm { font-size: 8pt; font-weight: 600; }
  .label svg { width: 36mm; height: 14mm; }
}
.label-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.label-preview .label {
  width: 40mm; height: 30mm; border: 1px dashed #BBB; padding: 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; background: #fff;
}
.label-preview .label svg { max-width: 38mm; }
.label-preview .nm { font-size: 9px; font-weight: 600; }
.label-preview .cd { font-size: 8px; color: #666; }

.toast { position: fixed; left: 50%; top: 24px; transform: translateX(-50%); background: rgba(0,0,0,.8); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 1000; }
.toast.show { opacity: 1; }
.scan-input { height: 44px; border: 2px solid var(--primary); border-radius: 8px; padding: 0 14px; font-size: 16px; width: 100%; }

/* ============ 弹窗表单 ============ */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 900; padding: 24px; }
.mask.show { display: flex; }
.dlg { width: 520px; max-width: 100%; max-height: 86vh; overflow: auto; background: #fff; border-radius: 14px; padding: 22px 24px; box-shadow: 0 16px 48px rgba(0,0,0,.22); }
.dlg h4 { margin: 0 0 18px; font-size: 16px; }
.fld { margin-bottom: 14px; }
.fld > label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.fld input[type=text], .fld input[type=number], .fld select, .fld textarea {
  width: 100%; height: 38px; border: 1px solid #DDDFE3; border-radius: 8px;
  padding: 0 12px; font-size: 14px; outline: none; font-family: inherit; background: #fff;
}
.fld textarea { height: 68px; padding: 8px 12px; resize: vertical; line-height: 1.5; }
.fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--primary); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 图片上传 */
.up { display: flex; gap: 14px; align-items: flex-start; }
.up-box { width: 92px; height: 92px; border: 1px dashed #CCD0D6; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; cursor: pointer; color: var(--sub); font-size: 12px;
  background: #FAFBFC; overflow: hidden; flex-shrink: 0; text-align: center; }
.up-box img { width: 100%; height: 100%; object-fit: cover; }
.up-box:hover { border-color: var(--primary); color: var(--primary); }

/* 分类卡片 */
.cats { display: flex; gap: 12px; flex-wrap: wrap; }
.cat { width: 158px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; }
.cat.off { opacity: .5; }
.cat .ico { font-size: 22px; line-height: 1.2; }
.cat .ico img { width: 34px; height: 34px; object-fit: cover; border-radius: 8px; }
.cat .nm { font-weight: 600; margin-top: 4px; }
.cat .ops { display: flex; gap: 6px; margin-top: 10px; }
.cat-add { width: 158px; border: 1px dashed #CCD0D6; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; color: var(--sub); cursor: pointer; min-height: 118px; font-size: 13px; }
.cat-add:hover { border-color: var(--primary); color: var(--primary); }

/* 列表缩略图 */
.thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: #F2F3F5; display: block; }
.ph { width: 46px; height: 46px; border-radius: 8px; background: #F2F3F5; display: flex; align-items: center;
  justify-content: center; font-size: 18px; color: #C9CDD4; }

/* 选项卡 */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs .t { padding: 7px 16px; border-radius: 8px; background: #fff; border: 1px solid var(--line);
  cursor: pointer; font-size: 13px; color: var(--sub); }
.tabs .t.on { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

/* 套餐卡片 */
.pk { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.pk .cover { height: 110px; background: #F2F3F5; display: flex; align-items: center; justify-content: center; color: #C9CDD4; }
.pk .cover img { width: 100%; height: 100%; object-fit: cover; }
.pk .bd { padding: 12px; }
.pk .nm { font-weight: 600; margin-bottom: 4px; }
.pk .pr { color: var(--red); font-weight: 700; font-size: 16px; }
.pk .pr s { color: var(--sub); font-weight: 400; font-size: 12px; margin-left: 6px; }
.pk.off { opacity: .55; }

/* 分账配置 */
.stl-row { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-bottom: 1px dashed var(--line); }
.stl-row:last-of-type { border-bottom: none; }
.stl-name { font-weight: 600; font-size: 15px; }
.stl-input { display: flex; align-items: center; gap: 6px; }
.stl-input input { width: 110px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; text-align: right; }
.stl-input span { color: var(--sub); }
.stl-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.stl-sum { font-size: 14px; }

/* 分账账户 */
.acct { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; }
.acct .nm { font-weight: 700; margin-bottom: 8px; }
.acct .nums { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 10px; }
.acct .nums .l { font-size: 12px; color: var(--sub); }
.acct .nums .v { font-size: 18px; font-weight: 700; }

/* 水洗唛网格预览（74:40 比例，与真实唛面一致的双列网格） */
.lb-card { display: inline-block; cursor: pointer; position: relative; }
.lb-card .lb-ck { position: absolute; top: 4px; left: 4px; z-index: 2; }
.lb-grid {
  width: 222px; height: 120px; border: 2px solid #333; background: #fff;
  display: flex; overflow: hidden; box-sizing: border-box;
}
.lb-card .lb-ck:not(:checked) ~ .lb-grid { opacity: .45; border-style: dashed; }
.lb-left {
  width: 50%; border-right: 2px solid #333; padding: 8px 6px;
  display: flex; flex-direction: column; justify-content: space-between; box-sizing: border-box;
}
.lb-nm { font-size: 12px; font-weight: 700; line-height: 1.3; word-break: break-all; }
.lb-cd { font-size: 10px; color: #444; letter-spacing: .5px; }
.lb-right {
  width: 50%; display: flex; align-items: center; justify-content: center; padding: 4px; box-sizing: border-box;
}
.lb-right svg { max-width: 100%; max-height: 90px; }

/* 履约照片弹层 */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; align-items: center; justify-content: center; }
.overlay .panel { background: #fff; border-radius: 10px; padding: 20px 24px; max-width: 860px; width: 92%; max-height: 84vh; overflow-y: auto; }
.overlay .panel h3 { margin: 0 0 8px; }
.ph-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.ph-grid img { width: 120px; height: 120px; object-fit: cover; border-radius: 6px; border: 1px solid #ddd; cursor: zoom-in; }
