/* cashbook.css — 企业流水账模块专用样式，复用 style.css 设计令牌 */

.cashbook-sub { display: none; animation: fadeIn .22s ease; }
.cashbook-sub.active { display: block; }

/* ============ 表单 ============ */
.cb-form-card { margin-bottom: 18px; }
.cb-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}
.cb-field { display: flex; flex-direction: column; gap: 6px; }
.cb-field--wide { grid-column: 1 / -1; }
.cb-field span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .01em;
}
.cb-field input, .cb-field select {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cb-field input:focus, .cb-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.cb-field input[readonly] {
  background: rgba(0,0,0,.03);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.cb-fx-hint { font-size: 11.5px; color: var(--text-secondary); }
.cb-form-actions { display: flex; gap: 10px; margin-top: 16px; }

/* 方向分段控件 */
.cb-seg { display: flex; gap: 4px; }
.cb-seg button {
  flex: 1;
  padding: 9px 0;
  border: 1px solid var(--border-strong);
  background: var(--bg-secondary);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s ease;
}
.cb-seg button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============ 列表头 / 筛选 ============ */
.cb-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cb-list-head .btn svg { width: 14px; height: 14px; }
.cb-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.cb-filter-bar select, .cb-filter-bar input {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  outline: none;
  max-width: 160px;
}
.cb-filter-bar input { flex: 1; min-width: 130px; }

/* ============ 表格 ============ */
.cb-table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-top: 12px; }
.cb-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.cb-table th {
  padding: 11px 13px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text-secondary);
  background: rgba(0,0,0,.025);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.cb-table td { padding: 10px 13px; border-bottom: 1px solid var(--border); }
.cb-table tbody tr:last-child td { border-bottom: none; }
.cb-table tbody tr:hover { background: var(--accent-soft); }
.cb-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cb-memo-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.cb-empty { text-align: center; color: var(--text-light); padding: 26px 0; font-size: 13px; }
.cb-loading { color: var(--text-secondary); font-size: 13px; padding: 18px 0; }

/* 方向标签 */
.cb-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 650;
}
.cb-tag.income { background: var(--success-soft); color: #1c8a3c; }
.cb-tag.expense { background: var(--danger-soft); color: #d73228; }

/* 行操作 */
.cb-row-actions { white-space: nowrap; text-align: right; }
.cb-row-actions button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 7px;
  transition: background .15s ease, color .15s ease;
}
.cb-row-actions button svg { width: 15px; height: 15px; }
.cb-row-actions button:hover { background: rgba(0,0,0,.06); color: var(--text-primary); }

/* ============ 月份切换条 ============ */
.cb-month-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.cb-month-bar input[type="month"] {
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  outline: none;
}

/* ============ 月度汇总 KPI ============ */
.cb-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.cb-kpi-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.kpi-label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }
.kpi-val { font-size: 26px; font-weight: 700; margin-top: 8px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi-val.positive, .positive { color: #1c8a3c; }
.kpi-val.negative, .negative { color: #d73228; }
.kpi-val.net { font-size: 28px; }
.kpi-foot { font-size: 11.5px; color: var(--text-secondary); margin-top: 4px; }

.cb-summary-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* ============ 类别管理 ============ */
.cb-cat-add { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.cb-cat-add select, .cb-cat-add input {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-secondary);
  outline: none;
}
.cb-cat-add input { flex: 1; min-width: 180px; }
.cb-cat-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cb-cat-ops { white-space: nowrap; }
.cb-cat-ops button { margin: 0 2px; padding: 5px 9px; }
.cb-cat-status { color: var(--text-secondary); font-size: 12.5px; }
.cb-disabled { opacity: .55; }
.cb-sys-badge {
  display: inline-block;
  margin-left: 7px;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 650;
  background: var(--accent-soft);
  color: var(--accent);
}
.cb-danger-text { color: #d73228 !important; }

/* ============ 汇率管理 ============ */
.cb-fx-add { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.cb-fx-add select, .cb-fx-add input {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-secondary);
  outline: none;
}
.cb-fx-add input[type="number"] { width: 190px; }
.cb-fx-note { font-size: 12px; color: var(--text-secondary); margin-top: 12px; line-height: 1.5; }
.cb-fx-switch { display: flex; gap: 6px; }
.cb-source {
  padding: 2px 9px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 650;
}
.cb-source.auto { background: var(--accent-soft); color: var(--accent); }
.cb-source.manual { background: var(--warning-soft); color: #c4760a; }

/* ============ Toast ============ */
.cashbook-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(29,29,31,.92);
  color: #fff;
  padding: 11px 20px;
  border-radius: 12px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity .22s ease, transform .22s ease;
  box-shadow: var(--shadow-lg);
  max-width: 80vw;
}
.cashbook-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.cashbook-toast.ok { background: rgba(28,138,60,.95); }
.cashbook-toast.err { background: rgba(215,50,40,.95); }

/* ============ 响应式 ============ */
@media (max-width: 960px) {
  .cb-form-grid { grid-template-columns: 1fr 1fr; }
  .cb-kpi-row { grid-template-columns: 1fr; }
  .cb-cat-columns { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .cb-form-grid { grid-template-columns: 1fr; }
  .cb-field--wide { grid-column: auto; }
  .cb-table { min-width: 640px; }
}
