/* ============================================================
   任务下发 · 样式
   依赖 09-tb.css 的 --tb-* 变量与 .tb-btn / .tb-card / .tb-tbl
   ============================================================ */

/* ---------- 头部 ---------- */
.task-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
}
.task-title h2 {
  margin: 0 0 6px; font-size: 18px; font-weight: 600; color: var(--tb-ink);
  letter-spacing: -.2px;
}
.task-title p { margin: 0; font-size: 12.5px; color: var(--tb-faint); line-height: 1.7; }
.task-acts { display: flex; gap: 10px; flex: 0 0 auto; }

/* ---------- 板块切换 ---------- */
.task-boards {
  display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.task-board {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 18px; border-radius: 11px; border: 1px solid var(--tb-line);
  background: #fff; color: var(--tb-ink-2); font-size: 13.5px; font-family: inherit;
  cursor: pointer; transition: .15s; text-align: left; box-shadow: var(--tb-shadow);
}
.task-board em { font-style: normal; font-size: 11.5px; color: var(--tb-faint); }
.task-board:hover { border-color: #CFD8E6; }
.task-board.on {
  border-color: var(--tb-red); background: #FFF9F9; color: var(--tb-red);
  box-shadow: 0 0 0 3px rgba(230, 0, 18, .06);
}
.task-board.on em { color: #D98A8E; }

/* ---------- 汇总条 ---------- */
.task-sum {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--tb-line-2);
  font-size: 12.5px; color: var(--tb-muted);
}
.task-sum b { color: var(--tb-ink); font-weight: 600; }
.task-dirty { color: #B26A00; }
.task-dirty b { color: #B26A00; }
.dim { color: var(--tb-faint); }

/* ---------- 矩阵表 ---------- */
.task-card { padding: 16px 18px 12px; }
.task-scroll { overflow-x: auto; }
.task-tbl { min-width: 720px; font-size: 13px; }
.task-tbl th {
  font-size: 11.5px; color: var(--tb-muted); font-weight: 500;
  padding: 9px 10px; white-space: nowrap;
}
.task-tbl td { padding: 5px 10px; vertical-align: middle; }

.task-tbl .th-ind, .task-tbl .td-ind {
  position: sticky; left: 0; z-index: 2; background: #fff;
  text-align: left; min-width: 200px;
}
.task-tbl th.th-ind { background: #FAFBFD; z-index: 3; }
.task-tbl .td-ind b {
  display: block; font-size: 13px; font-weight: 500; color: var(--tb-ink);
  line-height: 1.45;
}
.task-tbl .td-ind i {
  display: block; font-style: normal; font-size: 11px; color: var(--tb-faint); margin-top: 1px;
}
.task-tbl .th-unit, .task-tbl .td-unit {
  width: 46px; text-align: center; color: var(--tb-faint); font-size: 11.5px;
  white-space: nowrap;
}
.task-tbl .th-u { min-width: 150px; text-align: center; color: var(--tb-ink-2); }
.task-tbl .th-sum, .task-tbl .td-sum {
  min-width: 96px; text-align: right; white-space: nowrap;
  font-family: Menlo, Consolas, monospace; font-size: 12.5px; color: var(--tb-ink-2);
  background: #FAFBFD;
}
.task-tbl th.th-sum { background: #FAFBFD; color: var(--tb-muted); }
.task-tbl .td-sum.zero { color: var(--tb-faint); }

.task-group td {
  padding: 14px 10px 6px; font-size: 11.5px; color: var(--tb-faint);
  letter-spacing: .3px; border-bottom: 1px solid var(--tb-line-2);
}
.task-group em { font-style: normal; margin-left: 6px; color: #C1C9D6; }

/* 注意：01-base.css 给所有 input[type=number] 设了 width:100%，
   这里必须用「元素 + 类」提高特异性，否则输入框会被拉满整列 */
.task-tbl input.task-in {
  display: block;
  width: 100%; max-width: 148px; height: 32px; box-sizing: border-box;
  margin: 0 auto;
  border: 1px solid var(--tb-line); border-radius: 8px;
  padding: 0 9px; font-size: 13px; font-family: Menlo, Consolas, monospace;
  color: var(--tb-ink); background: #fff; outline: none; text-align: right;
  transition: border-color .15s, box-shadow .15s;
}
.task-in::placeholder { color: #C9D0DC; }
.task-in:hover { border-color: #CFD8E6; }
.task-in:focus { border-color: var(--tb-red); box-shadow: 0 0 0 3px rgba(230, 0, 18, .07); }
/* 隐藏数字框的上下箭头，避免误触 */
.task-in::-webkit-outer-spin-button,
.task-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.task-in { -moz-appearance: textfield; appearance: textfield; }

.task-foot { padding-top: 10px; }
.task-foot .hint { font-size: 11.5px; color: var(--tb-faint); }

/* ---------- 一键分摊弹窗 ---------- */
.task-split { display: flex; flex-direction: column; }
.task-split-h {
  padding: 20px 24px 14px; border-bottom: 1px solid var(--tb-line-2);
}
.task-split-h h3 { margin: 0 0 5px; font-size: 16.5px; font-weight: 600; color: var(--tb-ink); }
.task-split-h p { margin: 0; font-size: 12.5px; color: var(--tb-faint); }
.task-split-b { padding: 16px 24px 8px; }
.task-split-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.task-split-row label {
  flex: 0 0 88px; font-size: 12.5px; color: var(--tb-muted);
}
.task-split-row select, .task-split-row input {
  flex: 1 1 auto; min-width: 0; height: 38px; box-sizing: border-box;
  border: 1px solid var(--tb-line); border-radius: 9px; padding: 0 12px;
  font-size: 13.5px; font-family: inherit; color: var(--tb-ink);
  background: #fff; outline: none;
}
.task-split-row select:focus, .task-split-row input:focus {
  border-color: var(--tb-red); box-shadow: 0 0 0 3px rgba(230, 0, 18, .07);
}
.task-split-p { margin-top: 4px; }
.task-split-p:empty { margin: 0; }
.task-sp-tbl { font-size: 12.5px; }
.task-sp-tbl td { padding: 8px 10px; }
.task-sp-tbl b { color: var(--tb-ink); }
.task-split-f {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 24px 18px; border-top: 1px solid var(--tb-line-2);
}

/* ---------- 手工录入（tb-manual.js） ---------- */
.tb-manual { padding-bottom: 12px; }
.tb-manual-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-bottom: 14px; border-bottom: 1px solid var(--tb-line-2); margin-bottom: 12px;
}
.tb-manual-f { display: flex; align-items: center; gap: 8px; }
.tb-manual-f label { font-size: 12.5px; color: var(--tb-muted); white-space: nowrap; }
.tb-manual-f select, .tb-manual-f input[type="date"] {
  height: 34px; width: auto; min-width: 140px; box-sizing: border-box;
  border: 1px solid var(--tb-line); border-radius: 9px; padding: 0 10px;
  font-size: 13px; font-family: inherit; color: var(--tb-ink); background: #fff; outline: none;
}
.tb-manual-f select:focus, .tb-manual-f input:focus { border-color: var(--tb-red); }
.tb-manual-f select:disabled { background: #F7F9FC; color: var(--tb-muted); }
.tb-manual-sp { flex: 1 1 auto; }

.tb-manual-tip {
  font-size: 12px; color: #7A6A2F; background: #FFFBF0; border: 1px solid #F5E7C8;
  border-radius: 9px; padding: 9px 13px; margin-bottom: 14px; line-height: 1.7;
}

.tb-manual-tbl { font-size: 13px; }
.tb-manual-tbl th { font-size: 11.5px; color: var(--tb-muted); font-weight: 500; }
.tb-manual-tbl .tb-tbl-group td {
  padding: 14px 10px 6px; font-size: 11.5px; color: var(--tb-faint);
  border-bottom: 1px solid var(--tb-line-2);
}
.tb-manual-tbl .tb-tbl-group em { font-style: normal; margin-left: 6px; color: #C1C9D6; }
.tb-freq {
  display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 4px;
  margin-left: 6px; vertical-align: middle;
  background: #EAF4FF; color: #1677FF;
}
.tb-freq.week { background: #FFF4E6; color: #D46B08; }
.tb-freq.month { background: #EAF8EF; color: #2E9E5B; }

/* 同样要压过 01-base.css 的 width:100% */
.tb-manual-tbl input.tb-mv {
  display: block;
  width: 108px; height: 32px; box-sizing: border-box; text-align: right;
  margin-left: auto;
  border: 1px solid var(--tb-line); border-radius: 8px; padding: 0 9px;
  font-size: 13px; font-family: Menlo, Consolas, monospace; color: var(--tb-ink);
  background: #fff; outline: none;
}
.tb-mv:hover { border-color: #CFD8E6; }
.tb-mv:focus { border-color: var(--tb-red); box-shadow: 0 0 0 3px rgba(230, 0, 18, .07); }

.tb-src {
  display: inline-block; font-size: 10.5px; padding: 1.5px 7px; border-radius: 5px;
  white-space: nowrap;
}
.tb-src-tb { background: #EAF8EF; color: #2E9E5B; }
.tb-src-manual { background: #EAF4FF; color: #1677FF; }
.tb-src-demo { background: #F4F2FF; color: #722ED1; }
.tb-src-none { background: #F5F7FA; color: #A8B0C0; }

/* ---------- 同步设置卡 ---------- */
.tb-sync-top {
  display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-end;
  padding: 4px 0 16px; border-bottom: 1px solid var(--tb-line-2);
}
.tb-sync-kpi { display: flex; flex-direction: column; gap: 3px; }
.tb-sync-kpi em {
  font-style: normal; font-size: 11.5px; color: var(--tb-faint);
}
.tb-sync-kpi b {
  font-size: 19px; font-weight: 600; color: var(--tb-ink); line-height: 1.25;
}
.tb-sync-kpi b.tb-tag { font-size: 15px; }
.tb-sync-kpi span { font-size: 11.5px; color: var(--tb-faint); }
.tb-sync-act { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tb-sync-force { font-size: 12px; color: var(--tb-muted); display: flex; align-items: center; gap: 5px; cursor: pointer; }
.tb-sync-force input { accent-color: var(--tb-red); }

.tb-sync-warn {
  margin-top: 14px; padding: 10px 14px; border-radius: 9px;
  background: #FFFBF0; border: 1px solid #F5E7C8;
  font-size: 12.5px; color: #7A6A2F; line-height: 1.7;
}
.tb-sync-warn b { color: #B26A00; }

.tb-sync-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px;
}
.tb-sync-col-h {
  font-size: 12.5px; color: var(--tb-ink-2); font-weight: 500;
  padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--tb-line-2);
}
.tb-sync-col-h em {
  font-style: normal; font-weight: 400; font-size: 11.5px; color: var(--tb-faint);
  margin-left: 8px;
}
.tb-sync-list { max-height: 340px; overflow-y: auto; padding-right: 4px; }
.tb-sync-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px; font-size: 12.5px;
}
.tb-sync-item:hover { background: #FAFBFD; }
.tb-sync-item.unmapped { background: #FFFDF6; }
.tb-sync-item .n {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--tb-ink-2);
}
.tb-sync-item .r {
  flex: 0 0 auto; font-size: 11px; color: var(--tb-faint);
  font-family: Menlo, Consolas, monospace;
}
.tb-sync-item select {
  flex: 0 0 148px; width: 148px; height: 29px; box-sizing: border-box;
  border: 1px solid var(--tb-line); border-radius: 7px; padding: 0 6px;
  font-size: 12px; font-family: inherit; color: var(--tb-ink);
  background: #fff; outline: none;
}
.tb-sync-item select:focus { border-color: var(--tb-red); }
.tb-sync-item.unmapped select { border-color: #E8CFA0; background: #FFFDF6; }
.tb-sync-cat {
  font-style: normal; font-size: 9.5px; color: var(--tb-faint);
  margin-left: 5px; letter-spacing: .3px;
}

.tb-sync-foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--tb-line-2);
}
.tb-sync-foot .hint { font-size: 11.5px; color: var(--tb-faint); }

.tb-sync-logs { margin-top: 18px; }
.tb-sync-logs .tb-tbl { font-size: 12.5px; }
.tb-sync-logs .tb-tbl td { padding: 8px 10px; }

.tb-sync-line {
  margin-top: 10px; padding: 9px 13px; border-radius: 9px;
  font-size: 12.5px; background: #F3FAF6; color: #237A45;
  border: 1px solid #D6EEDF;
}
.tb-sync-line b { font-weight: 600; }
.tb-sync-line.warn { background: #FFFBF0; color: #7A6A2F; border-color: #F5E7C8; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .tb-sync-cols { grid-template-columns: 1fr; gap: 18px; }
  .tb-sync-list { max-height: none; }
}
@media (max-width: 760px) {
  .task-head { flex-direction: column; align-items: stretch; }
  .task-acts { justify-content: flex-end; }
  .task-boards { gap: 8px; }
  .task-board { flex: 1 1 calc(50% - 8px); padding: 9px 13px; font-size: 13px; }
  .tb-manual-bar { gap: 10px; }
  .tb-manual-f { flex: 1 1 100%; }
  .tb-manual-f select, .tb-manual-f input[type="date"] { flex: 1 1 auto; min-width: 0; }
  .tb-manual-sp { display: none; }
  .tb-sync-act { margin-left: 0; width: 100%; }
  .tb-sync-item select { flex: 0 0 120px; width: 120px; }
  .task-split-row { flex-wrap: wrap; }
  .task-split-row label { flex: 0 0 100%; }
}
