/* ============================================================
   fundBlock.css — 资金管理区块
   配色对齐飞书「中天财务资金管理」原页面：青绿系 + 橙系
   ============================================================ */

.fund-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  position: relative;
}

/* ---------- 头部 ---------- */
.fund-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 14px;
}
.fund-head h3 { font-size: 15px; font-weight: 600; }
.fund-head h3 .sub {
  font-size: 12px; font-weight: 400; color: var(--text-secondary);
  margin-left: 8px;
}
.fund-head-right { display: flex; align-items: center; gap: 12px; }
.fund-head .edit-hint { font-size: 11px; color: var(--text-tertiary); }

/* ---------- 月份筛选条 ---------- */
.fund-months {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}
.fm-chip {
  appearance: none; cursor: pointer;
  padding: 5px 13px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-secondary);
  font-size: 12px; font-family: var(--font-sans);
  transition: all .14s ease;
}
.fm-chip:hover { border-color: var(--blue); color: var(--text-primary); }
.fm-chip.on {
  background: var(--blue); border-color: var(--blue);
  color: var(--bg-deep); font-weight: 600;
}
/* 无数据的月份弱化，但仍可点（点了显示 0） */
.fm-chip.empty { opacity: .42; }
.fm-chip.empty:hover { opacity: .75; }

/* ---------- 五张汇总卡 ---------- */
.fund-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.fund-card {
  border-radius: var(--radius-sm);
  padding: 14px 16px 16px;
  min-height: 92px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #FFFFFF;
  position: relative;
  overflow: hidden;
}
/* 青绿系（深）—— 对应飞书前三张卡 */
.fund-card.tone-teal { background: linear-gradient(150deg, var(--gradient-teal-start) 0%, var(--gradient-teal-end) 100%); }
/* 橙色系（浅）—— 回款可支付 */
.fund-card.tone-amber { background: linear-gradient(150deg, var(--gradient-amber-start) 0%, var(--gradient-amber-end) 100%); }
/* 橙色系（深）—— 暂缓支付 */
.fund-card.tone-orange { background: linear-gradient(150deg, var(--gradient-orange-start) 0%, var(--gradient-orange-end) 100%); }

.fund-card .fc-label {
  font-size: 12.5px; font-weight: 500;
  opacity: .92; display: flex; align-items: center; gap: 6px;
}
.fund-card .fc-label .mk {
  font-style: normal; font-size: 10px; opacity: 0;
  transition: opacity .14s ease;
}
.fund-card.drillable { cursor: pointer; }
.fund-card.drillable:hover .mk { opacity: .85; }
.fund-card.drillable:hover { filter: brightness(1.09); }
.fund-card.drillable:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.fund-card .fc-value {
  font-size: 30px; font-weight: 700; line-height: 1.1;
  font-family: var(--font-mono);
  letter-spacing: -.5px;
}

/* ---------- 余额表小标题 ---------- */
.fund-sub-title {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
  font-size: 13px; font-weight: 500; color: var(--text-primary);
}
.fund-sub-title .tag {
  font-size: 11px; font-weight: 400;
  color: var(--text-secondary);
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 2px 10px;
}

/* ---------- 余额表 ---------- */
.fund-table-wrap { overflow-x: auto; }

.fund-table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px; min-width: 980px;
}
.fund-table th {
  text-align: left; font-weight: 500;
  color: var(--text-secondary); font-size: 11.5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.fund-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  white-space: nowrap;
}
.fund-table tbody tr { transition: background .12s ease; }
.fund-table tbody tr:hover { background: var(--blue-bg); }

.fund-table .c-num { text-align: right; font-family: var(--font-mono); }
.fund-table th.c-num { text-align: right; }
.fund-table .c-strong { color: var(--blue); font-weight: 600; }
.fund-table .c-formula { color: var(--text-secondary); }
.fund-table .c-name { font-weight: 500; color: var(--text-primary); }
.fund-table .c-people, .fund-table .c-time { color: var(--text-secondary); font-size: 12px; }

/* 主体名前的小色点 */
.fund-table .co-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); margin-right: 7px; vertical-align: middle;
}

/* 只读值（公式列） */
.cell-ro { color: inherit; }

/* ---------- 可编辑格 ---------- */
.fund-block .cell-edit {
  cursor: pointer;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 1px;
  display: inline-flex; align-items: center; gap: 3px;
  transition: color .12s ease, border-color .12s ease;
}
.fund-block .cell-edit:hover { color: var(--blue); border-color: var(--blue); }
.fund-block .cell-edit:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 3px; }
.fund-block .cell-edit .pen {
  font-style: normal; font-size: 10px; opacity: 0;
  transition: opacity .12s ease;
}
.fund-block .cell-edit:hover .pen, .fund-block .cell-edit:focus-visible .pen { opacity: .8; }

.fund-block .cell-input {
  width: 100%; min-width: 60px; max-width: 150px;
  background: var(--bg-panel);
  border: 1px solid var(--blue);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12.5px; font-family: var(--font-mono);
  padding: 3px 6px;
  text-align: right;
}
.fund-block select.cell-input { font-family: var(--font-sans); text-align: left; }
.fund-block .cell-input:focus { outline: none; }

.fund-block .cell-saving { color: var(--text-tertiary); font-size: 12px; }

/* ---------- 本月支付情况（已支付 / 批准待支付 / 未批准） ---------- */
.fund-pay {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-items: start;
}

.fp-col {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  overflow: hidden;
}

.fp-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px; font-weight: 600;
}
.fp-head .fp-stat { font-size: 11px; font-weight: 400; font-family: var(--font-mono); }

/* 三栏配色：已支付=绿、批准待支付=琥珀、未批准=橙（与上方卡片色系同族） */
.fp-col.tone-paid .fp-head { color: var(--green); background: var(--green-bg-alt); border-bottom-color: var(--green-border); }
.fp-col.tone-paid .fp-head .fp-stat { color: var(--green); }
.fp-col.tone-toPay .fp-head { color: var(--amber); background: var(--amber-bg); border-bottom-color: var(--amber); }
.fp-col.tone-toPay .fp-head .fp-stat { color: var(--amber); }
.fp-col.tone-unapproved .fp-head { color: var(--orange); background: var(--orange-bg); border-bottom-color: var(--orange-border); }
.fp-col.tone-unapproved .fp-head .fp-stat { color: var(--orange); }

.fp-list {
  list-style: none; margin: 0; padding: 0;
  /* 三栏随事项数量自然展开，仅保留页面滚动，不设栏内滚动。 */
  max-height: none; overflow: visible;
}

.fp-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px;
}
.fp-item:last-child { border-bottom: none; }
.fp-item:hover { background: var(--blue-bg); }

.fp-item .fp-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-primary);
}
.fp-item .fp-tag {
  flex: none; font-size: 10px; color: var(--text-secondary);
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: 3px; padding: 1px 5px;
  max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fp-item .fp-amt {
  flex: none; font-family: var(--font-mono); font-weight: 600;
  color: var(--text-primary); min-width: 58px; text-align: right;
}
.fp-item .fp-follow { flex: none; }

.fp-none {
  padding: 18px 12px; text-align: center;
  color: var(--text-tertiary); font-size: 11.5px;
}

/* ---------- 事项明细弹层（fundDetailModal.js） ---------- */
.fd-sub {
  font-size: 12px; color: var(--text-secondary);
  margin: -4px 0 12px;
}

.fd-table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px;
}
.fd-table th {
  text-align: left; font-weight: 500;
  color: var(--text-secondary); font-size: 11.5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.fd-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.fd-table tbody tr:hover { background: var(--blue-bg); }
.fd-table .fd-c-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.fd-table .fd-c-num { text-align: right; font-family: var(--font-mono); }
.fd-table .fd-c-act { text-align: center; width: 86px; }
.fd-table tfoot td {
  border-top: 1px solid var(--border);
  border-bottom: none;
  font-weight: 600; padding-top: 11px;
}
.fd-table tfoot .fd-c-num { color: var(--blue); }

/* 支付状态小标 */
.fd-tag {
  display: inline-block; border-radius: 3px;
  padding: 1px 6px; font-size: 11px; white-space: nowrap;
}
.fd-tag.ok { color: var(--green); background: var(--green-bg-alt); border: 1px solid var(--green-border); }
.fd-tag.wait { color: var(--amber); background: var(--amber-bg); border: 1px solid var(--amber); }

.fd-empty {
  padding: 34px 0; text-align: center;
  color: var(--text-tertiary); font-size: 12px;
}

/* ---------- 底部说明 & 空态 ---------- */
.fund-foot {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  font-size: 11px; color: var(--text-tertiary); line-height: 1.6;
}
.fund-empty {
  padding: 40px; text-align: center;
  color: var(--text-secondary); font-size: 13px;
}

/* ---------- Toast ---------- */
.fund-toast {
  position: absolute; right: 18px; bottom: 14px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 12px; max-width: 62%;
  opacity: 0; transform: translateY(6px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 5;
}
.fund-toast.show { opacity: 1; transform: translateY(0); }
.fund-toast.ok { background: var(--green-bg-alt); color: var(--green); border: 1px solid var(--green-border); }
.fund-toast.err { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }

/* 跟进弹窗只增加支付状态编辑，不影响原进展与历史布局。 */
.fund-pay-editor { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.fund-pay-editor .sv-field { flex: 1; min-width: 140px; margin: 0; }
.fund-pay-editor .sv-select { width: 100%; }
.fund-pay-editor [data-pay-message] { flex-basis: 100%; line-height: 1.6; overflow-wrap: anywhere; }
.fund-pay-editor button:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 响应式 ---------- */
@media (max-width: 1400px) {
  .fund-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
  .fund-pay { grid-template-columns: 1fr; }
  .fp-list { max-height: none; }
}
@media (max-width: 900px) {
  .fund-cards { grid-template-columns: repeat(2, 1fr); }
  .fund-card .fc-value { font-size: 24px; }
}
@media (max-width: 640px) {
  .fund-cards { grid-template-columns: 1fr; }
  .fund-head { flex-direction: column; }
  .fund-toast { position: static; margin-top: 10px; max-width: none; }
}
