:root {
  --bg: #f3f7f4;
  --surface: #ffffff;
  --ink: #243128;
  --muted: #637567;
  --line: #d8e2d7;
  --brand: #2e7d4f;
  --brand-soft: #e7f5ec;
  --accent: #1f5d7a;
  --accent-soft: #e5f1f7;
  --danger: #b3261e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(1000px 340px at -8% -10%, #e7f4ea, transparent 65%),
    radial-gradient(900px 260px at 110% -10%, #e8f3f9, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f5fbf7 100%);
}

.brand {
  font-size: 22px;
  font-weight: 800;
  color: var(--brand);
}

.brand-sub {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.side-nav nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.side-nav a:hover {
  background: #f0f8f3;
  border-color: #d2e7d8;
}

.container {
  max-width: 1200px;
  margin: 18px auto;
  padding: 0 20px 24px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(24, 52, 31, 0.05);
}

.grid-two {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.spread {
  justify-content: space-between;
}

input,
select,
button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

button {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: #cbe7d4;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(39, 109, 70, 0.18);
}

.entry-row {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr .9fr .9fr 1.2fr auto;
  gap: 8px;
  margin: 8px 0;
}

.journal-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
  background: linear-gradient(180deg, #ffffff, #fcfffd);
}

.error {
  color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
}

.simple-table {
  width: 100%;
  border-collapse: collapse;
}

.simple-table th,
.simple-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px;
}

.inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.journal-hero {
  border: 1px solid #cae3d2;
  background: linear-gradient(140deg, #fbfffc 0%, #f3faf5 55%, #edf6f9 100%);
}

.subtitle {
  margin-top: -4px;
  color: var(--muted);
}

.form-toolbar {
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed #d5e4d8;
}

.flow-panel {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #d7e5d9;
  background: #fff;
}

.flow-panel h3 {
  margin: 2px 0 10px;
}

.transfer-row {
  display: grid;
  grid-template-columns: 1.2fr auto 1.2fr .9fr .8fr 1.2fr auto;
  gap: 8px;
  margin: 8px 0;
  align-items: center;
}

.journal-layout {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 12px;
  align-items: start;
}

.left-col,
.right-col {
  min-height: 100%;
}

.arrow {
  color: var(--accent);
  font-weight: 700;
  text-align: center;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  border: 1px solid #c8dde9;
}

.pill.clickable {
  text-decoration: none;
}

.pill.clickable:hover {
  background: #d7ebf6;
  border-color: #b4d2e2;
}

.flow-list {
  margin: 10px 0;
  display: grid;
  gap: 6px;
}

.preview-box {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #d6e4d8;
  border-radius: 10px;
  background: #fbfefb;
}

.preview-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.preview-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0;
}

.balance-tip {
  color: var(--muted);
}

.muted {
  color: var(--muted);
  margin: 6px 0;
}

.flow-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid #d5e5ec;
  background: #f7fbfd;
}

.ai-config-form {
  display: grid;
  gap: 12px;
}

.ai-config-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.ai-config-form textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  resize: vertical;
  min-height: 160px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.ok-text {
  color: #1f7a43;
  font-weight: 600;
  margin: 0;
}

.ai-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid #cfe1d4;
  background: linear-gradient(145deg, #fbfffc, #eef7f1 62%, #e9f3f8);
}

.ai-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-config-layout {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 12px;
  align-items: start;
}

.ai-config-main,
.ai-config-side {
  min-height: 100%;
}

.ai-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ai-test-banner {
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid #d4e4d8;
  background: #f8fdf9;
  padding: 10px 12px;
}

.ai-test-banner.fail {
  border-color: #f2c7c5;
  background: #fff7f7;
}

.ai-summary-list,
.ai-tip-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--ink);
}

.ai-summary-list li,
.ai-tip-list li {
  margin: 6px 0;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .grid-two {
    grid-template-columns: 1fr;
  }

  .journal-layout {
    grid-template-columns: 1fr;
  }

  .entry-row {
    grid-template-columns: 1fr;
  }

  .transfer-row {
    grid-template-columns: 1fr;
  }

  .ai-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .ai-config-layout,
  .ai-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Active nav highlight */
.side-nav a.active {
  background: var(--brand-soft);
  border-color: #c2dfc9;
  color: var(--brand);
  font-weight: 600;
}

/* Inline action link buttons */
.btn-edit {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid #d2e7d8;
  background: var(--brand-soft);
  color: var(--brand);
  text-decoration: none;
  font-size: 13px;
  transition: transform .12s ease, box-shadow .12s ease;
}

.btn-edit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(39, 109, 70, 0.15);
}

/* Export / download button */
.btn-export {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid #bed4e3;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: transform .12s ease, box-shadow .12s ease;
}

.btn-export:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 93, 122, 0.15);
}

/* ==========================================================================
   新增记账页面 (journal_new) 专用样式
   ========================================================================== */

/* 页面动画 */
.journal-page {
  animation: fadeInUp 0.35s ease-out;
  padding-bottom: 90px;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 页头 */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--brand);
  margin: 0 0 6px;
  letter-spacing: -0.4px;
}

.page-desc {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

/* 弹出提示 */
.alert {
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-error {
  background: #fff2f2;
  color: var(--danger);
  border: 1px solid #fccaca;
}

/* ── 按钮系统 ── */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--line);
  transition: all .18s ease;
  cursor: pointer;
}

.btn-ghost:hover {
  color: var(--ink);
  border-color: #b0c4b5;
  background: #f4f8f5;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all .18s ease;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 10px rgba(46, 125, 79, .2);
}

.btn-primary:hover {
  background: #246740;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(46, 125, 79, .3);
}

.btn-secondary {
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid #cbe7d4;
}

.btn-secondary:hover {
  border-color: var(--brand);
  background: #d8f0e2;
}

.btn-ghost-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
  font-size: 13px;
}

.btn-ghost-danger:hover {
  background: rgba(179, 38, 30, .07);
  border-color: rgba(179, 38, 30, .15);
}

.btn-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  transition: all .18s ease;
  padding: 0;
}

.btn-icon:hover {
  background: rgba(0, 0, 0, .06);
  color: var(--ink);
}

.btn-danger-ghost {
  color: #d32f2f;
}

.btn-danger-ghost:hover {
  background: #ffebee;
  color: #b71c1c;
}

/* ── 卡片 ── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, .03);
  margin-bottom: 20px;
  transition: box-shadow .25s ease;
}

.form-card:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, .05);
}

.form-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.form-card-icon {
  font-size: 22px;
}

.form-card-title {
  flex: 1;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

/* ── 两栏布局 ── */
.journal-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1100px) {
  .journal-columns {
    grid-template-columns: 1fr;
  }
}

/* ── 徽章 ── */
.badge {
  background: var(--brand-soft);
  color: var(--brand);
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.badge-outline {
  background: transparent;
  border: 1px solid currentColor;
}

/* ── 表单组件 ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-group-inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flex-fill {
  flex: 1;
  min-width: 80px;
}

.form-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.form-label-sm {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 14px;
  background: #fefefe;
  transition: all .2s ease;
  color: var(--ink);
  font-family: inherit;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.input-readonly {
  background: #f2f4f3;
  color: var(--muted);
  cursor: default;
  border-color: transparent;
}

.input-amount {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 700;
  color: var(--brand);
  font-size: 15px;
}

.input-debit {
  color: var(--brand);
  font-weight: 700;
  font-family: ui-monospace, Consolas, monospace;
}

.input-credit {
  color: #d97706;
  font-weight: 700;
  font-family: ui-monospace, Consolas, monospace;
}

.input-narrow {
  width: 72px;
}

/* ── 流向卡片 ── */
.transfer-list,
.entry-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.transfer-card,
.entry-card {
  border: 1px solid #e2eadf;
  border-radius: 12px;
  padding: 14px 16px;
  background: linear-gradient(160deg, #fbfefb, #f6fbf7);
  transition: all .2s ease;
}

.transfer-card:hover,
.entry-card:hover {
  border-color: #bdd5c5;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .04);
  background: #fff;
}

.transfer-card-head,
.entry-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #dde8de;
}

.transfer-index,
.entry-index {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  background: #f0f3f1;
  padding: 2px 8px;
  border-radius: 5px;
  letter-spacing: .4px;
}

/* 流向账户区 */
.transfer-body {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.transfer-account {
  flex: 1;
}

.transfer-arrow-wrap {
  display: flex;
  align-items: flex-end;
  padding-bottom: 10px;
}

.transfer-arrow {
  color: var(--brand);
  opacity: 0.7;
}

.transfer-details {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.transfer-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #dde8de;
}

.balance-hint {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 5px;
}

.balance-hint::before {
  content: "💳";
}

/* 手动分录 */
.entry-card-body {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.entry-card-amounts {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* ── 分录预览 ── */
.preview-section {
  margin-top: 20px;
  background: #f7faf8;
  border: 1px solid #d8e8db;
  border-radius: 12px;
  padding: 18px 20px;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.preview-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-active {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .2);
  animation: pulseGreen 2s infinite;
}

.dot-idle {
  background: #cbd5e1;
}

@keyframes pulseGreen {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, .5);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.preview-empty {
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
  padding: 18px 0;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  margin: 0;
}

.preview-entries {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.preview-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 13px;
  background: #fff;
  border: 1px solid #e2e8e0;
  border-radius: 8px;
  font-size: 13px;
}

.preview-account {
  font-weight: 600;
  color: var(--ink);
}

.preview-amounts {
  display: flex;
  gap: 10px;
  align-items: center;
}

.debit-val {
  color: var(--brand);
  font-weight: 700;
}

.credit-val {
  color: #d97706;
  font-weight: 700;
}

.currency-val {
  color: #94a3b8;
  font-size: 12px;
}

/* ── 空状态 ── */
.empty-state-sm {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 0;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: #64748b;
  font-size: 13px;
  gap: 6px;
}

/* ── 底部固定操作栏 ── */
.action-bar {
  position: fixed;
  bottom: 0;
  left: 220px;
  right: 0;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 14px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 200;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .04);
}

@media (max-width: 900px) {
  .action-bar {
    left: 0;
    padding: 14px 20px;
  }
}

.balance-display {
  display: flex;
  align-items: center;
  gap: 12px;
}

.balance-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.balance-value {
  font-size: 22px;
  font-weight: 800;
  font-family: ui-monospace, Consolas, monospace;
  transition: color .3s ease;
}

.balanced {
  color: #059669;
}

.unbalanced {
  color: #ef4444;
}

.balance-status {
  background: #ecfdf5;
  color: #059669;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #a7f3d0;
}

.action-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-primary-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #2e7d4f 0%, #1b4f31 100%);
  color: #fff;
  padding: 12px 30px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(46, 125, 79, .3);
  transition: all .2s cubic-bezier(.16, 1, .3, 1);
}

.btn-primary-lg:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(46, 125, 79, .4);
}

/* ==========================================================================
   分析报告页面 (reports) 专用样式
   ========================================================================== */

.report-page {
  animation: fadeInUp 0.35s ease-out;
}

/* 页头 + 月份导航 */
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.month-label {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  min-width: 80px;
  text-align: center;
  letter-spacing: 1px;
}

.month-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  padding: 0;
  border-radius: 10px;
}

.month-btn-disabled {
  opacity: 0.35;
  pointer-events: none;
}

.refresh-btn {
  font-size: 13px;
  padding: 7px 14px;
}

/* ── 摘要卡片 ── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .stat-cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .stat-cards {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  border-radius: 16px;
  padding: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border: 1px solid transparent;
  transition: transform .2s ease, box-shadow .2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .07);
}

.stat-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  font-family: ui-monospace, Consolas, monospace;
  line-height: 1;
}

.stat-sub {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
}

.stat-income {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-color: #bbf7d0;
}

.stat-income .stat-value {
  color: #16a34a;
}

.stat-expense {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border-color: #fed7aa;
}

.stat-expense .stat-value {
  color: #ea580c;
}

.stat-net-pos {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: #bfdbfe;
}

.stat-net-pos .stat-value {
  color: #2563eb;
}

.stat-net-neg {
  background: linear-gradient(135deg, #fff2f2, #fee2e2);
  border-color: #fecaca;
}

.stat-net-neg .stat-value {
  color: #dc2626;
}

.stat-save {
  background: linear-gradient(135deg, #faf5ff, #ede9fe);
  border-color: #ddd6fe;
}

.stat-save .stat-value {
  color: #7c3aed;
}

/* ── 双栏布局 ── */
.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .report-grid {
    grid-template-columns: 1fr;
  }
}

.report-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 空状态 */
.report-empty {
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  padding: 40px 0;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
}

/* ── 分类排行 ── */
.cat-rank-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}


.cat-rank-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.cat-rank-name {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.cat-rank-amount {
  font-size: 14px;
  font-weight: 700;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--ink);
}

.cat-rank-pct {
  font-size: 12px;
  color: #64748b;
  min-width: 38px;
  text-align: right;
}

.cat-rank-bar-wrap {
  height: 8px;
  background: #f0f0f0;
  border-radius: 999px;
  overflow: hidden;
}

.cat-rank-bar {
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
  transition: width 0.6s cubic-bezier(.4, 0, .2, 1);
}

.bar-ok {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.bar-warn {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.bar-danger {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

/* ── AI 面板 ── */

.badge-ai {
  background: #ede9fe;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}

.badge-rule {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.badge-expense {
  background: #ffedd5;
  color: #ea580c;
  border: 1px solid #fed7aa;
}

.ai-warnings {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-warning-item {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-left: 4px solid #f97316;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #9a3412;
}

.ai-insight {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.ai-insight-label {
  font-size: 11px;
  font-weight: 700;
  color: #16a34a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.ai-insight-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.5;
}

.ai-reason {
  margin-bottom: 16px;
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
}

.ai-reason p {
  margin: 6px 0 0;
}

.ai-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 10px;
}

.ai-actions {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-action-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}

.action-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: var(--brand);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.ai-goal {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe;
  border-left: 4px solid #3b82f6;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.ai-goal-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.ai-goal-label {
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.ai-goal-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.ai-footer {
  font-size: 11px;
  color: #94a3b8;
  text-align: right;
  margin-top: 4px;
}

/* ==========================================================================
   购物清单页面 (shopping_list) 专用样式
   ========================================================================== */

/* 页面布局 */
.sl-page {
  animation: fadeInUp 0.35s ease-out;
}

/* ── 页头 ── */
.sl-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.sl-summary-chips {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.sl-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  border: 1px solid transparent;
}

.sl-chip-count {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.sl-chip-budget {
  background: #fdf4ff;
  border-color: #e9d5ff;
  color: #7c3aed;
}

.sl-chip strong {
  font-size: 16px;
}

/* ── 快捷添加栏 ── */
.sl-quickadd-wrap {
  background: white;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .03);
  transition: box-shadow .2s ease, border-color .2s ease;
}

.sl-quickadd-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft), 0 4px 20px rgba(0, 0, 0, .04);
}

.sl-qa-main {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sl-qa-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  padding: 6px 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
}

.sl-qa-input::placeholder {
  color: #94a3b8;
}

.sl-qa-btn {
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 8px 20px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s ease;
  flex-shrink: 0;
}

.sl-qa-btn:hover {
  background: #246740;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(46, 125, 79, .3);
}

.sl-qa-extra {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #dde8de;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.sl-qa-extra.qa-extra-visible {
  display: flex;
}

.sl-qa-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sl-qa-num {
  width: 70px;
}

.sl-qa-price {
  width: 100px;
}

.sl-qa-date {
  width: 140px;
}

.sl-qa-note {
  flex: 1;
  min-width: 140px;
}

/* 优先级切换按钮 */
.sl-priority-toggle {
  display: flex;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.sl-prio-btn {
  border: none;
  background: transparent;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #64748b;
  transition: all .15s ease;
}

.sl-prio-btn:hover {
  background: #f0f8f3;
}

.sl-prio-active {
  background: var(--brand);
  color: white;
}

.sl-prio-active:hover {
  background: var(--brand);
}

/* ── 双栏布局 ── */
.sl-body {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1024px) {
  .sl-body {
    grid-template-columns: 1fr;
  }
}

.sl-list-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 过滤 Tab */
.sl-tabs {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
}

.sl-tab {
  flex: 1;
  text-align: center;
  padding: 8px 14px;
  border-radius: 9px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  transition: all .2s ease;
}

.sl-tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, .6);
}

.sl-tab-active {
  background: white;
  color: var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

/* ── 清单卡片 ── */
.sl-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sl-card {
  display: flex;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: all .2s ease;
}

.sl-card:hover {
  border-color: #bdd5c5;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .05);
}

.sl-card-done {
  opacity: 0.65;
  background: #f8fafc;
}

/* 优先级竖条 */
.sl-card-prio {
  width: 5px;
  flex-shrink: 0;
}

.prio-high {
  background: linear-gradient(180deg, #ef4444, #dc2626);
}

.prio-normal {
  background: linear-gradient(180deg, #f59e0b, #d97706);
}

.prio-low {
  background: #cbd5e1;
}

.sl-card-body {
  flex: 1;
  padding: 14px 16px;
}

.sl-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}

.sl-card-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 优先级徽章 */
.sl-prio-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.prio-badge-high {
  background: #fee2e2;
  color: #dc2626;
}

.prio-badge-normal {
  background: #fef3c7;
  color: #b45309;
}

.prio-badge-low {
  background: #f1f5f9;
  color: #64748b;
}

.sl-card-price {
  font-size: 13px;
  color: #64748b;
  white-space: nowrap;
}

.sl-card-price strong {
  color: var(--brand);
  font-size: 15px;
}

.sl-card-note {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 6px;
}

.sl-card-date {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.sl-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sl-action-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s ease;
}

.btn-done {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

.btn-done:hover {
  background: #d1fae5;
}

.btn-journal {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

.btn-journal:hover {
  background: #dbeafe;
}

.btn-undo {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}

.btn-undo:hover {
  background: #ffedd5;
}

.btn-delete {
  background: transparent;
  color: #ef4444;
  border-color: transparent;
}

.btn-delete:hover {
  background: #fee2e2;
  border-color: #fecaca;
}

/* ── 空状态 ── */
.sl-empty {
  text-align: center;
  padding: 48px 0;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
}

.sl-empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.sl-empty-sub {
  font-size: 13px;
  margin-top: 4px;
}

/* ── AI 面板 ── */
.sl-ai-desc {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 14px;
  line-height: 1.6;
}

.sl-ai-trigger {
  width: 100%;
  justify-content: center;
  gap: 10px;
  padding: 13px 0;
}

/* 旋转动画 */
.spin-anim {
  animation: spinCW 1s linear infinite;
}

@keyframes spinCW {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   账户设置页面 (account_settings) 专用样式
   ========================================================================== */

/* ── 账户类型选择器 ── */
.acc-type-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 900px) {
  .acc-type-picker {
    grid-template-columns: 1fr 1fr;
  }
}

.acc-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fafafa;
  cursor: pointer;
  transition: all .2s ease;
  text-align: center;
}

.acc-type-btn:hover {
  border-color: #b0c4b5;
  background: #f3f9f4;
  transform: translateY(-2px);
}

.acc-type-icon {
  font-size: 26px;
}

.acc-type-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.acc-type-desc {
  font-size: 11px;
  color: #94a3b8;
}

/* Active states by type */
.acc-type-btn.acc-type-active.acc-type-asset {
  border-color: #3b82f6;
  background: #eff6ff;
}

.acc-type-btn.acc-type-active.acc-type-asset .acc-type-name {
  color: #2563eb;
}

.acc-type-btn.acc-type-active.acc-type-liability {
  border-color: #ef4444;
  background: #fff2f2;
}

.acc-type-btn.acc-type-active.acc-type-liability .acc-type-name {
  color: #dc2626;
}

.acc-type-btn.acc-type-active.acc-type-income {
  border-color: #22c55e;
  background: #f0fdf4;
}

.acc-type-btn.acc-type-active.acc-type-income .acc-type-name {
  color: #16a34a;
}

.acc-type-btn.acc-type-active.acc-type-expense {
  border-color: #f97316;
  background: #fff7ed;
}

.acc-type-btn.acc-type-active.acc-type-expense .acc-type-name {
  color: #ea580c;
}

/* ── 新增表单布局 ── */
.acc-create-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.acc-create-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* ── Tabs Navigation ── */
.acc-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 0px;
}

.acc-tab-btn {
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  padding: 10px 18px;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all .2s ease;
  box-shadow: none;
}

.acc-tab-btn:hover {
  background: #f1f5f9;
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.acc-tab-btn.active {
  background: var(--surface);
  color: var(--brand);
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--surface);
  margin-bottom: -2px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.03);
  z-index: 10;
  position: relative;
}

.acc-tab-content {
  display: none;
}

.acc-tab-content.active {
  display: block;
  animation: fadeInUp 0.3s ease-out;
}

/* ── 分组卡片 ── */
.acc-group-total {
  margin-left: auto;
  font-size: 13px;
  color: #64748b;
}

.acc-group-total strong {
  font-size: 16px;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--ink);
}

.acc-group-desc {
  font-size: 12px;
  color: #94a3b8;
}

/* Badges per type */
.acc-badge-asset {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.acc-badge-liability {
  background: #fff2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.acc-badge-income {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.acc-badge-expense {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
}

/* ── 账户表格 ── */
.acc-table-wrap {
  overflow-x: auto;
}

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

.acc-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.acc-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.acc-table tbody tr:last-child td {
  border-bottom: none;
}

.acc-table tbody tr:hover {
  background: #fafcfa;
}

.acc-row-inactive {
  opacity: 0.55;
}

.acc-num {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
}

/* Account name chips */
.acc-name-chip {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
}

/* Balance highlight colors */
.acc-bal-nonzero-asset {
  color: #2563eb;
}

.acc-bal-nonzero-liability {
  color: #dc2626;
}

.acc-bal-nonzero-income {
  color: #16a34a;
}

.acc-bal-nonzero-expense {
  color: #ea580c;
}

/* Status badges */
.acc-status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.acc-status-active {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.acc-status-inactive {
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
}

/* Action area */
.acc-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.acc-inline-form {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.acc-bal-input {
  width: 80px;
  padding: 5px 8px;
  font-size: 13px;
  border-radius: 7px;
}

/* Empty state */
.acc-empty {
  text-align: center;
  padding: 24px;
  color: #94a3b8;
  font-size: 13px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
}

/* ── 复式记账理论卡片 ── */
.acc-theory-card {
  margin-top: 0;
}

.acc-theory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 900px) {
  .acc-theory-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.acc-theory-item {
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid transparent;
}

.acc-theory-asset {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.acc-theory-liability {
  background: #fff2f2;
  border-color: #fecaca;
}

.acc-theory-income {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.acc-theory-expense {
  background: #fff7ed;
  border-color: #fed7aa;
}

.acc-theory-head {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--ink);
}

.acc-theory-rule {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

.acc-theory-eg {
  font-size: 12px;
  color: #94a3b8;
}

/* Example entry */
.acc-theory-example {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
}

.acc-theory-example-label {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  display: block;
  margin-bottom: 10px;
}

.acc-theory-entries {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.acc-entry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
}

.acc-dr {
  color: #2563eb;
  font-weight: 600;
}

.acc-cr {
  color: #dc2626;
  font-weight: 600;
  padding-left: 24px;
}

.acc-amount {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 700;
  color: var(--ink);
}

/* ── 内联编辑行 ── */
.acc-edit-inline-form {
  display: flex;
  align-items: flex-end;
}

.acc-edit-inline-fields {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
  width: 100%;
}

/* ── 两步删除确认 ── */
.acc-delete-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.del-confirm-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: fadeInUp 0.2s ease-out;
}

.del-confirm-label {
  font-size: 12px;
  font-weight: 700;
  color: #dc2626;
  white-space: nowrap;
}

/* ══ Toast 全局提示 ══ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  animation: toastSlideIn 0.35s ease-out;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  border-left: 4px solid #94a3b8;
}

.toast-success {
  background: #f0fdf4;
  border-left-color: #22c55e;
  color: #166534;
}

.toast-error {
  background: #fef2f2;
  border-left-color: #ef4444;
  color: #991b1b;
}

.toast-warning {
  background: #fffbeb;
  border-left-color: #f59e0b;
  color: #92400e;
}

.toast-info {
  background: #eff6ff;
  border-left-color: #3b82f6;
  color: #1e40af;
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast-text {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
  padding: 0 2px;
  line-height: 1;
}

.toast-close:hover {
  opacity: 1;
}

.toast-fade-out {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.4s, transform 0.4s;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ══ 分类管理页 ══ */
.cat-page { }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.cat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.cat-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.cat-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #f1f5f1;
}

.cat-card-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  border-radius: 10px;
}

.cat-card-info {
  flex: 1;
  min-width: 0;
}

.cat-card-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.cat-card-group {
  display: inline-block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  background: #f0f4f1;
  padding: 1px 8px;
  border-radius: 4px;
}

.cat-card-meta {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.cat-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f0f4f1;
  color: var(--muted);
  white-space: nowrap;
}

.cat-badge-budget {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.cat-children {
  padding: 0 18px;
}

.cat-child-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f5f8f5;
  font-size: 14px;
}

.cat-child-row:last-child {
  border-bottom: none;
}

.cat-child-icon {
  font-size: 18px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.cat-child-name {
  flex: 1;
  color: var(--ink);
  font-weight: 500;
}

.cat-edit-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.cat-edit-btn:hover {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: #cbe7d4;
}

.cat-add-child-btn {
  background: none;
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--brand);
  cursor: pointer;
  transition: all 0.15s;
}

.cat-add-child-btn:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.cat-card-actions {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid #f1f5f1;
}

.cat-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.cat-modal-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #dbe7de;
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.22);
  padding: 22px;
}

.cat-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
}
