/* =========================================================
   日常记账页 —— 清新治愈风（浅鼠尾草绿 + 奶油白 + 柔和米黄）
   依赖 style.css 提供基础布局与主题变量（--accent 等）
   ========================================================= */

/* ===== 面板 ===== */
.panel {
  background: var(--panel);
  border-radius: 20px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.panel-head h3 { margin: 0; font-size: 15.5px; font-weight: 800; }

.panel-tag {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--panel-2);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ===== 两列布局 ===== */
.acc-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  align-items: start;
}

.acc-left, .acc-right { display: flex; flex-direction: column; gap: 20px; }

/* ===== 快速记账 ===== */
.quick-add { display: flex; gap: 10px; }

.quick-add input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 13px;
  padding: 12px 15px;
  font-size: 13.5px;
  color: var(--text);
  font-family: inherit;
  outline: none;
}

.quick-add input:focus { border-color: var(--accent); }

.quick-add button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 13px;
  padding: 0 20px;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: filter .18s ease;
}

.quick-add button:hover { filter: brightness(1.08); }

.hint { margin: 10px 2px 0; font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }

/* ===== 表单 ===== */
.acc-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }

.field > span { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }

.field input, .field select {
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 13.5px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  width: 100%;
}

.field input:focus, .field select:focus { border-color: var(--accent); }

.type-toggle {
  grid-column: 1 / -1;
  display: inline-flex;
  gap: 6px;
  background: var(--panel-2);
  border-radius: 13px;
  padding: 5px;
}

.type-toggle button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  transition: background .18s ease, color .18s ease;
}

.type-toggle button.active { background: var(--accent); color: #fff; }

.form-actions { display: flex; gap: 10px; }

.btn-primary {
  flex: 1;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 13px;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  transition: filter .18s ease;
}

.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 13px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
}

.btn-ghost:hover { background: var(--panel-2); color: var(--text); }

/* ===== 明细表格 ===== */
.table-wrap { overflow-x: auto; }

.acc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 480px; }

.acc-table th {
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.acc-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.acc-table tbody tr:last-child td { border-bottom: none; }
.acc-table tbody tr:hover { background: var(--panel-2); }

.acc-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.amt-expense { color: #c96a5a; font-weight: 700; }
.amt-income { color: #6f9160; font-weight: 700; }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

.icon-act {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 8px;
  transition: background .15s ease, color .15s ease;
}

.icon-act:hover { background: var(--panel-2); color: var(--accent); }
.icon-act.del:hover { color: #c06a55; }

.empty-row { text-align: center; color: var(--text-muted); padding: 26px 10px !important; }

/* ===== 过滤 / 汇总 tabs ===== */
.filter-tabs, .sum-tabs { display: inline-flex; gap: 4px; background: var(--panel-2); border-radius: 11px; padding: 4px; }

.sum-tabs { width: 100%; margin-bottom: 16px; }

.filter-tabs button, .sum-tabs button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  transition: background .18s ease, color .18s ease;
}

.filter-tabs button.active, .sum-tabs button.active { background: var(--panel); color: var(--accent); box-shadow: var(--shadow); }

.sum-tabs button { flex: 1; }

/* ===== 汇总内容 ===== */
.sum-body { font-size: 13.5px; }

.sum-headline {
  background: linear-gradient(120deg, var(--accent) 0%, #a9c48d 100%);
  color: #fff;
  border-radius: 15px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.sum-headline .sh-label { font-size: 12.5px; opacity: .9; }
.sum-headline .sh-value { font-size: 24px; font-weight: 800; margin-top: 2px; }
.sum-headline .sh-sub { font-size: 12px; opacity: .9; margin-top: 4px; }

.sum-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 2px;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}

.sum-row:last-child { border-bottom: none; }
.sum-row .sr-name { color: var(--text-muted); }
.sum-row .sr-val { font-variant-numeric: tabular-nums; font-weight: 600; }

.sum-empty { color: var(--text-muted); text-align: center; padding: 20px 0; font-size: 13px; }

/* ===== 分类占比 ===== */
.cat-break { display: flex; flex-direction: column; gap: 12px; }

.cat-item .ci-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }

.cat-item .ci-name { color: var(--text); font-weight: 600; }
.cat-item .ci-val { color: var(--text-muted); font-variant-numeric: tabular-nums; }

.cat-bar { height: 7px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.cat-bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), #a9c48d); transition: width .4s ease; }

.cat-empty { color: var(--text-muted); text-align: center; padding: 20px 0; font-size: 13px; }

/* ===== 响应式 ===== */
@media (max-width: 1000px) {
  .acc-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .acc-form { grid-template-columns: 1fr; }
  .quick-add { flex-direction: column; }
  .quick-add button { padding: 12px; }
  .welcome h2 { font-size: 18px; }
}

/* ===== 手机端适配（手机优先） ===== */
@media (max-width: 640px) {
  .acc-grid { gap: 16px; }
  .acc-left, .acc-right { gap: 16px; }
  .panel { padding: 16px; border-radius: 16px; }
  .panel-head { margin-bottom: 12px; }
  .quick-add input { padding: 12px 14px; }
  .sum-headline .sh-value { font-size: 22px; }
  .btn-primary, .btn-ghost { padding: 12px 16px; }
}

@media (max-width: 560px) {
  /* 明细表：小屏隐藏「支付」列，避免横向滚动与内容溢出 */
  .acc-table { min-width: 0; }
  .acc-table th:nth-child(4), .acc-table td:nth-child(4) { display: none; }
  .acc-table th, .acc-table td { padding: 10px 8px; }
  .acc-table td { word-break: break-word; }
  .quick-add button { min-height: 44px; }
}
