:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #1f2328;
  --muted: #667085;
  --primary: #2563eb;
  --primary-soft: #eff4ff;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.04);
}

* { box-sizing: border-box; }

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

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px 64px; }

/* ---------- header ---------- */
header.top {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.top-inner {
  max-width: 1240px; margin: 0 auto; padding: 14px 24px 0;
}
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.brand h1 { font-size: 17px; font-weight: 650; margin: 0; letter-spacing: .2px; }
.brand .sub {
  color: var(--muted); font-size: 12.5px;
  padding-left: 14px; border-left: 1px solid var(--border);
}
.dot-live {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  display: inline-block; margin-right: 5px;
  box-shadow: 0 0 0 3px rgba(6,118,71,.12);
}

nav.tabs { display: flex; gap: 2px; }
nav.tabs button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 9px 14px; font-size: 13.5px; color: var(--muted);
  border-bottom: 2px solid transparent; font-family: inherit;
  transition: color .15s;
}
nav.tabs button:hover { color: var(--text); }
nav.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
nav.tabs .badge {
  display: inline-block; min-width: 17px; padding: 0 5px; margin-left: 5px;
  background: var(--danger); color: #fff; border-radius: 8px;
  font-size: 11px; line-height: 16px; text-align: center; font-weight: 600;
}

/* ---------- layout ---------- */
.view { display: none; padding-top: 22px; }
.view.active { display: block; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }

.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 17px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.stat .value { font-size: 26px; font-weight: 680; letter-spacing: -.5px; line-height: 1.1; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat.danger .value { color: var(--danger); }
.stat.warn .value { color: var(--warn); }
.stat.ok .value { color: var(--ok); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 14.5px; font-weight: 620; margin: 0; }
.card-head .hint { color: var(--muted); font-size: 12.5px; }
.card-body { padding: 4px 0; }
.card-body.pad { padding: 18px; }

/* ---------- table ---------- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-weight: 560; font-size: 12.5px; color: var(--muted);
  padding: 10px 18px; background: #fafbfc; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 12px 18px; border-bottom: 1px solid #f1f3f6; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfd; }
td.mono, .mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 560; line-height: 18px; white-space: nowrap;
}
.tag.gray { background: #f2f4f7; color: #475467; }
.tag.blue { background: var(--primary-soft); color: var(--primary); }
.tag.green { background: var(--ok-soft); color: var(--ok); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.amber { background: var(--warn-soft); color: var(--warn); }

.bar { height: 6px; background: #eef1f5; border-radius: 4px; overflow: hidden; width: 96px; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }

/* 表头筛选行 */
.filter-row td {
  padding: 6px 8px; background: #fcfcfd; border-bottom: 1px solid var(--border);
}
.filter-row input[type=text], .filter-row select {
  width: 100%; padding: 5px 8px; font-size: 12.5px; border-radius: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
}
.filter-row input[type=text]:focus, .filter-row select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.1);
}
.chk-col { width: 34px; text-align: center; padding-left: 14px !important; padding-right: 2px !important; }
.chk-col input[type=checkbox] { width: 14px; height: 14px; cursor: pointer; accent-color: var(--primary); }
tr.row-selected > td { background: var(--primary-soft); }
tbody tr.row-selected:hover > td { background: #e4edff; }

/* 任务图片列 */
.img-head { width: 58px; }
.img-cell { width: 58px; padding: 7px 4px 7px 10px !important; }
/* 列变多后允许横向滚动，避免各列被压窄导致换行 */
#taskTable { overflow-x: auto; }
#taskTable table { min-width: 1180px; }
#taskTable th, #taskTable td { padding-left: 12px; padding-right: 12px; }
#taskTable th:nth-child(6), #taskTable td:nth-child(6),
#taskTable th:nth-child(7), #taskTable td:nth-child(7) { min-width: 78px; }
tbody td .btn-row { flex-wrap: nowrap; }
tbody td .btn-row button { white-space: nowrap; }
tbody td.nowrap, tbody td.mono { white-space: nowrap; }
.fb-cell {
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #475467; font-size: 12.5px;
}
.thumb {
  width: 38px; height: 38px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); cursor: pointer; display: block;
  transition: transform .12s, border-color .12s;
}
.thumb:hover { transform: scale(1.08); border-color: var(--primary); }
.img-add {
  width: 38px; height: 38px; padding: 0; font-size: 17px; color: #98a2b3;
  display: flex; align-items: center; justify-content: center; border-radius: 6px;
}
.img-add:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }

/* 产品部页面 */
.dept-intro {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  background: linear-gradient(135deg, #eef4ff 0%, #f8fafc 100%);
  border: 1px solid #dbe6fb; border-radius: 10px;
  padding: 18px 20px; margin-bottom: 16px;
}
.dept-intro h2 { margin: 0 0 6px; font-size: 16px; font-weight: 620; color: #101828; }
.dept-intro p { margin: 0; font-size: 13px; color: #475467; line-height: 1.7; max-width: 780px; }
.dept-people { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.dept-people .who {
  font-size: 12.5px; color: #475467; background: #fff; border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 12px; white-space: nowrap;
}
.dept-people .who b { color: var(--primary); }
.sub { font-size: 12px; color: #98a2b3; margin-top: 3px; line-height: 1.5; }

/* 可编辑单元格 */
td.editable {
  cursor: text;
  position: relative;
  border-radius: 4px;
  transition: background .12s;
}
td.editable:hover { background: #eef4ff; }
td.editable:hover::after {
  content: '✎';
  font-size: 10px;
  color: #98a2b3;
  margin-left: 5px;
  vertical-align: 1px;
}
td.editing { padding: 4px 6px !important; }
td.editing:hover::after { content: none; }
.cell-input {
  width: 100%; min-width: 74px; padding: 4px 6px;
  font-size: 13px; color: var(--text);
  border: 1px solid var(--primary); border-radius: 5px;
  outline: none; background: #fff;
  box-shadow: 0 0 0 2px rgba(37,99,235,.12);
}

/* 打款参考图 + 产品资料 */
.link-code { color: var(--primary); cursor: pointer; border-bottom: 1px dashed rgba(37,99,235,.35); }
.link-code:hover { border-bottom-style: solid; }

.pay-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.pay-img-add {
  width: 64px; height: 64px; border: 1px dashed #c7d2e0; border-radius: 8px;
  background: #fafbfc; color: #98a2b3; font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.pay-img-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.pay-thumb {
  position: relative; width: 64px; height: 64px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border); background: #f2f4f7;
}
.pay-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pay-thumb.big { width: 86px; height: 86px; }
.pay-thumb.big img { cursor: zoom-in; }
.pay-rm {
  position: absolute; top: 2px; right: 2px; width: 17px; height: 17px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(16,24,40,.62); color: #fff;
  font-size: 12px; line-height: 16px; cursor: pointer;
}
.pay-rm:hover { background: var(--danger); }

.pi-section { margin-top: 16px; }
.pi-label { font-size: 12.5px; color: #667085; font-weight: 560; margin-bottom: 8px; }
.pi-note {
  font-size: 13px; color: #344054; line-height: 1.75; white-space: pre-wrap;
  background: #fafbfc; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; max-height: 200px; overflow-y: auto;
}
.pi-empty { font-size: 12.5px; color: #98a2b3; padding: 10px 0; }

.f textarea {
  width: 100%; padding: 9px 12px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 8px; outline: none; resize: vertical;
  color: var(--text);
}
.f textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* 产品等级标签 */
.lv {
  display: inline-block; padding: 2px 7px; border-radius: 5px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.lv-s { background: #fee4e2; color: #b42318; }
.lv-a { background: #fff4e5; color: #b54708; }
.lv-b { background: #e8f0fe; color: #1d4ed8; }
.lv-c { background: #eef1f5; color: #475467; }
.lv-gray { background: #f2f4f7; color: #98a2b3; }

/* 缩略图与张数角标 */
.thumb-wrap { position: relative; width: 38px; height: 38px; cursor: pointer; }
.thumb-num {
  position: absolute; right: -5px; bottom: -5px;
  background: var(--primary); color: #fff; font-size: 10px; font-weight: 600;
  min-width: 16px; height: 16px; line-height: 16px; text-align: center;
  border-radius: 8px; padding: 0 3px; border: 1.5px solid #fff;
}

/* 多图预览弹窗 */
.img-main {
  background: #f8f9fb; border: 1px solid var(--border); border-radius: 8px;
  min-height: 240px; display: flex; align-items: center; justify-content: center; padding: 10px;
}
.img-main img { max-width: 100%; max-height: 52vh; border-radius: 6px; display: block; }
.img-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ithumb {
  width: 56px; height: 56px; object-fit: cover; border-radius: 6px;
  border: 2px solid transparent; cursor: pointer; opacity: .65; transition: all .12s;
}
.ithumb:hover { opacity: 1; }
.ithumb.on { border-color: var(--primary); opacity: 1; }

/* ---------- buttons ---------- */
button.btn {
  appearance: none; font-family: inherit; cursor: pointer; font-size: 13px;
  padding: 7px 13px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: #fff; color: var(--text); transition: all .15s; font-weight: 520;
}
button.btn:hover { background: #f9fafb; border-color: #b9c0cb; }
button.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.btn.primary:hover { background: #1d4ed8; }
button.btn.danger { color: var(--danger); border-color: #f3c7c3; }
button.btn.danger:hover { background: var(--danger-soft); }
button.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
button.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- forms ---------- */
label.f { display: block; margin-bottom: 13px; }
label.f > span { display: block; font-size: 12.5px; color: #344054; margin-bottom: 5px; font-weight: 520; }
input[type=text], input[type=date], input[type=datetime-local], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 8px;
  font-family: inherit; font-size: 13.5px; color: var(--text); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea { resize: vertical; min-height: 78px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

.stage-plan { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.stage-plan .row {
  display: grid; grid-template-columns: 1fr 1.3fr 76px 26px; gap: 8px; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid #f1f3f6;
}
.stage-plan .row:last-child { border-bottom: 0; }
.stage-plan .row .nm { font-size: 13px; color: #344054; font-weight: 520; }
.stage-plan input { padding: 6px 9px; font-size: 13px; }
.stage-plan .sp-name { font-weight: 560; }
.stage-plan .sp-del {
  border: 0; background: transparent; color: #98a2b3; font-size: 18px; line-height: 1;
  cursor: pointer; padding: 0; width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.stage-plan .sp-del:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- modal ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(16,24,40,.42);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 6vh 16px; overflow-y: auto;
}
.mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 560px;
  box-shadow: 0 20px 48px rgba(16,24,40,.18); overflow: hidden;
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal-body { overflow-y: auto; }
.modal-head, .modal-foot { flex: 0 0 auto; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 620; }
.modal-head .x {
  border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--muted);
  cursor: pointer; padding: 0 4px;
}
.modal-body { padding: 18px 20px; max-height: 66vh; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border); background: #fafbfc;
  display: flex; justify-content: flex-end; gap: 9px;
}
.meta-line {
  background: #f8f9fb; border: 1px solid var(--border); border-radius: 8px;
  padding: 11px 13px; font-size: 13px; color: #344054; margin-bottom: 16px; line-height: 1.7;
}
.meta-line b { font-weight: 600; color: var(--text); }

/* ---------- misc ---------- */
.empty { padding: 40px 18px; text-align: center; color: var(--muted); font-size: 13px; }
.logline {
  padding: 11px 18px; border-bottom: 1px solid #f1f3f6;
  display: grid; grid-template-columns: 74px 1fr 90px; gap: 12px; align-items: start; font-size: 13px;
}
.logline:last-child { border-bottom: 0; }
.logline .t { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.msg {
  margin-top: 7px; background: #f8f9fb; border: 1px solid #eef0f4; border-radius: 7px;
  padding: 9px 12px; font-size: 12.5px; line-height: 1.75; color: #475467;
}
.msg .msg-h {
  font-weight: 620; color: var(--text); font-size: 13px; margin-bottom: 2px;
}
.msg .msg-q {
  margin-top: 7px; padding-left: 9px; border-left: 2px solid var(--border-strong); color: var(--muted);
}
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(14px);
  background: #1f2328; color: #fff; padding: 10px 18px; border-radius: 9px;
  font-size: 13.5px; opacity: 0; transition: all .22s; z-index: 200; pointer-events: none;
  box-shadow: 0 8px 24px rgba(16,24,40,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #b42318; }
.sep { height: 1px; background: var(--border); margin: 18px 0; }
.kv { display: grid; grid-template-columns: 132px 1fr; gap: 9px 14px; font-size: 13px; }
.kv .k { color: var(--muted); }
.help { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.65; }
code.inline {
  background: #f2f4f7; padding: 1px 5px; border-radius: 4px;
  font-family: ui-monospace, Consolas, monospace; font-size: 12px;
}

/* 测试发送结果 */
.test-result {
  margin-top: 14px; padding: 12px 14px; border-radius: 8px; font-size: 13px;
  border: 1px solid var(--border); background: #f8f9fb;
}
.test-result.ok { background: var(--ok-soft); border-color: #a9e5c4; color: var(--ok); }
.test-result.fail { background: var(--danger-soft); border-color: #f5c2bd; color: var(--danger); }
.test-result.pending { background: var(--primary-soft); border-color: #c6d8fb; color: var(--primary); }
.test-result .tr-title { font-weight: 600; line-height: 1.6; }
.test-result .tr-hint {
  margin-top: 6px; font-size: 12.5px; line-height: 1.7;
  color: #475467; font-weight: 400;
}
.log-err {
  margin-top: 7px; padding: 8px 11px; border-radius: 6px;
  background: var(--danger-soft); border: 1px solid #f5c2bd;
  color: var(--danger); font-size: 12.5px; line-height: 1.7;
}
.log-note {
  margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.65;
}
