/* ============ 基础 ============ */
html, body { height: 100%; }
body { font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }

/* 图表容器必须给定高度，否则 ECharts 初始化为 0 尺寸 */
.chart-box {
  width: 100%;
  height: 320px;
}

/* ============ Tab 切换栏 ============ */
.tab-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  transition: all .15s ease;
}
.tab-btn:hover { color: #4338ca; }
.tab-btn.active {
  background: #4f46e5;
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(79, 70, 229, 0.5);
}

/* 总账分类切换（支出/收入） */
.catview-btn {
  padding: 0.25rem 0.75rem;
  border-radius: 0.5rem;
  color: #64748b;
  font-weight: 500;
  transition: all .15s ease;
}
.catview-btn.active { background: #4f46e5; color: #fff; }

/* 大类/小类 分组切换（与 catview 同款样式） */
.grp-btn {
  padding: 0.25rem 0.75rem;
  border-radius: 0.5rem;
  color: #64748b;
  font-weight: 500;
  transition: all .15s ease;
  cursor: pointer;
}
.grp-btn.active { background: #4f46e5; color: #fff; }

/* ============ 弹窗 ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}
.modal-card {
  width: 100%;
  max-width: 28rem;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 1.5rem;
  max-height: 90vh;
  overflow-y: auto;
  animation: pop .18s ease-out;
}
@keyframes pop {
  from { transform: translateY(8px) scale(.98); opacity: 0; }
  to   { transform: translateY(0)  scale(1);   opacity: 1; }
}

/* ============ 类型切换按钮 ============ */
/* 中国习惯：支出=绿(跌)，收入=红(涨) */
.type-btn {
  padding: 0.625rem 0;
  border-radius: 0.75rem;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  color: #64748b;
  background: #fff;
  transition: all .15s ease;
}
.type-btn.active.type-expense {
  border-color: #22c55e;
  background: #22c55e;
  color: #fff;
}
.type-btn.active.type-income {
  border-color: #ef4444;
  background: #ef4444;
  color: #fff;
}

/* ============ 表格微调 ============ */
#txnTableBody td { padding: 0.75rem 1.25rem; vertical-align: middle; }
#txnTableBody .amount-cell { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ============ 明细表固定高度滚动 ============ */
#tableScroll {
  overflow-y: auto;
  /* max-height 由 JS 按窗口高度设置，保证回不到筛选区 */
}

/* ============ 图表可点击放大 ============ */
.chart-box.zoomable {
  cursor: zoom-in;
  position: relative;
}
.chart-box.zoomable::after {
  content: "⤢";
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 16px;
  color: #94a3b8;
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
}
.chart-box.zoomable:hover::after { opacity: 1; }

/* ============ 日期框点击提示 ============ */
.showpicker { cursor: pointer; }

/* ============ 图表放大弹窗 ============ */
#chartZoomBox { width: 100%; height: 70vh; }

/* ============ Toast ============ */
#toastContainer > div {
  padding: 0.625rem 1.125rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 10px 25px -8px rgba(0, 0, 0, 0.3);
  animation: toastIn .2s ease-out;
}
#toastContainer .toast-success { background: #10b981; }
#toastContainer .toast-error   { background: #f43f5e; }
#toastContainer .toast-info    { background: #475569; }
@keyframes toastIn {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

/* 隐藏滚动条美化（可选） */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
