:root {
  --bg: #fff9f4;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(220, 182, 168, 0.28);
  --line-soft: rgba(225, 204, 194, 0.22);
  --text: #4f3f3a;
  --muted: #8a766e;
  --rose: #db7e99;
  --rose-deep: #bf607c;
  --peach: #f5b48f;
  --gold: #d4a04a;
  --mint: #c8e1d4;
  --mint-deep: #6b8777;
  --sky: #dfe8fb;
  --sky-deep: #6a7eb4;
  --lavender: #ece5ff;
  --shadow: 0 18px 40px rgba(197, 132, 109, 0.12);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 214, 221, 0.72), transparent 26%),
    radial-gradient(circle at top right, rgba(245, 228, 180, 0.58), transparent 24%),
    linear-gradient(180deg, #fff9f4 0%, #fffdfa 42%, #fff7f1 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.38;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.76), transparent 82%);
}

h1,
h2,
h3,
h4 {
  font-family: "STSong", "Noto Serif SC", serif;
  margin: 0;
  letter-spacing: 0.01em;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

.page {
  width: min(1320px, calc(100% - 32px));
  margin: 24px auto 48px;
  position: relative;
  z-index: 1;
}

.surface,
.top-nav,
.hero,
.section-card,
.stat-card,
.quick-action,
.upload-panel,
.recent-panel,
.summary-card,
.chart-card,
.table-wrap,
.config-card,
.insight-card,
.mobile-preview,
.tip-card,
.footer-note {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.top-nav {
  position: sticky;
  top: 10px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-radius: 22px;
  margin-bottom: 18px;
}

.brand strong {
  display: block;
  font-size: 18px;
  color: var(--rose-deep);
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(230, 210, 200, 0.36);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--rose-deep);
  background: linear-gradient(135deg, rgba(255, 240, 244, 0.96), rgba(255, 255, 255, 0.98));
  border-color: rgba(219, 126, 153, 0.26);
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 36px;
  padding: 34px;
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 28px;
  animation: rise 0.55s ease-out both;
}

.hero::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  top: -90px;
  right: -92px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 196, 209, 0.52) 0%, rgba(255, 196, 209, 0) 72%);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--rose-deep);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.hero h1 {
  margin-top: 18px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.12;
}

.hero p {
  margin-top: 16px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--muted);
  max-width: 56ch;
}

.hero-tags,
.chip-row,
.config-list,
.inline-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-tags {
  margin-top: 22px;
}

.hero-tag,
.pill,
.config-chip {
  padding: 9px 13px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid transparent;
}

.hero-tag {
  background: linear-gradient(135deg, rgba(252, 239, 221, 0.96), rgba(255, 255, 255, 0.92));
  border-color: rgba(242, 193, 146, 0.28);
}

.hero-side {
  display: grid;
  gap: 14px;
  align-content: start;
}

.mini-card {
  padding: 18px 18px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.82);
}

.mini-card strong {
  display: block;
  font-size: 30px;
  color: var(--rose-deep);
  margin-top: 10px;
}

.mini-card span,
.muted,
.field-hint,
.item-sub,
.section-head p {
  color: var(--muted);
}

.section-head p,
.item-sub {
  font-size: 13px;
  line-height: 1.7;
}

.layout {
  display: grid;
  gap: 22px;
  margin-top: 22px;
}

.section-card,
.upload-panel,
.recent-panel,
.summary-card,
.chart-card,
.table-wrap,
.config-card,
.insight-card,
.mobile-preview,
.tip-card,
.footer-note {
  border-radius: var(--radius-xl);
  padding: 22px;
  animation: rise 0.72s ease-out both;
}

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

.search-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(218, 179, 164, 0.22);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.section-subgrid {
  display: grid;
  gap: 22px;
}

.home-stats,
.summary-stats,
.settings-summary,
.page-actions-grid {
  display: grid;
  gap: 18px;
}

.home-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-stats {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.settings-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.page-actions-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}

.stat-card {
  border-radius: 26px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -40px -50px auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0));
}

.stat-card .label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 18px;
  font-size: clamp(28px, 3vw, 38px);
  color: var(--rose-deep);
  line-height: 1;
}

.stat-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.stat-total {
  background: linear-gradient(135deg, rgba(255, 241, 232, 0.96), rgba(255, 255, 255, 0.92));
}

.stat-medical {
  background: linear-gradient(135deg, rgba(247, 234, 213, 0.96), rgba(255, 255, 255, 0.92));
}

.stat-shopping {
  background: linear-gradient(135deg, rgba(232, 244, 236, 0.96), rgba(255, 255, 255, 0.92));
}

.stat-selfpay {
  background: linear-gradient(135deg, rgba(236, 242, 255, 0.96), rgba(255, 255, 255, 0.92));
}

.stat-accent {
  background: linear-gradient(135deg, rgba(246, 237, 255, 0.96), rgba(255, 255, 255, 0.92));
}

.quick-action {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line-soft);
}

.quick-action strong {
  display: block;
  margin-top: 6px;
  color: var(--rose-deep);
  font-size: 18px;
}

.quick-action p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.page-grid,
.stats-grid,
.mine-grid,
.charts {
  display: grid;
  gap: 22px;
  align-items: start;
}

.page-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.stats-grid {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.mine-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.charts {
  grid-template-columns: 1.15fr 0.85fr;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 14px;
  color: var(--rose-deep);
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid rgba(218, 179, 164, 0.22);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(220, 125, 152, 0.45);
  box-shadow: 0 0 0 4px rgba(220, 125, 152, 0.12);
  transform: translateY(-1px);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.form-grid,
.filters-grid,
.settings-grid,
.budget-grid,
.category-grid {
  display: grid;
  gap: 16px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.filters-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.settings-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.budget-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.category-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.upload-box {
  position: relative;
  border-radius: 22px;
  border: 1.5px dashed rgba(220, 125, 152, 0.36);
  background:
    linear-gradient(135deg, rgba(255, 244, 247, 0.95), rgba(255, 255, 255, 0.96)),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(220, 125, 152, 0.04) 10px, rgba(220, 125, 152, 0.04) 20px);
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  display: block;
}

.upload-box input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-box strong {
  display: block;
  margin-top: 10px;
  font-size: 18px;
}

.upload-box p {
  margin: 8px auto 0;
  max-width: 30ch;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.preview {
  display: none;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(229, 208, 198, 0.38);
  margin-top: 16px;
}

.preview img {
  width: 100%;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.status-chip {
  border-radius: 18px;
  padding: 12px 10px;
  background: rgba(255, 255, 255, 0.74);
  text-align: center;
  border: 1px solid rgba(233, 216, 207, 0.48);
}

.status-chip strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 14px;
}

.ocr-note {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 248, 234, 0.88);
  color: #8a6d31;
  font-size: 13px;
  line-height: 1.7;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.button {
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(197, 132, 109, 0.16);
}

.button.primary {
  background: linear-gradient(135deg, var(--rose), var(--peach));
  color: #fff;
}

.button.secondary {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  border: 1px solid rgba(219, 184, 171, 0.38);
}

.button.ghost {
  background: rgba(246, 237, 255, 0.8);
  color: var(--sky-deep);
}

.recent-list,
.summary-list,
.insight-list,
.preference-list,
.mobile-ledger-list {
  display: grid;
  gap: 12px;
}

.recent-item,
.summary-card,
.insight-card,
.mobile-ledger-card,
.tip-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line-soft);
}

.recent-item-head,
.summary-row,
.mobile-ledger-head,
.config-inline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.recent-item strong,
.summary-row strong,
.mobile-ledger-amount,
.insight-number {
  color: var(--rose-deep);
}

.recent-item p,
.summary-card p,
.tip-card p,
.insight-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.summary-row strong,
.insight-number {
  font-size: 22px;
  white-space: nowrap;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(232, 223, 216, 0.65);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose), var(--peach));
}

.progress.green span {
  background: linear-gradient(90deg, #8cc0a9, #cbe3d6);
}

.progress.sky span {
  background: linear-gradient(90deg, #8ea8e8, #dce7fb);
}

.progress.gold span {
  background: linear-gradient(90deg, #d6a446, #f0d7a0);
}

.filter-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(252, 239, 221, 0.96), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(242, 193, 146, 0.28);
  font-size: 14px;
}

.filter-chip.active {
  background: linear-gradient(135deg, rgba(255, 240, 244, 0.96), rgba(255, 255, 255, 0.95));
  border-color: rgba(219, 126, 153, 0.26);
  color: var(--rose-deep);
  font-weight: 700;
}

.category-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(232, 215, 205, 0.44);
}

.category-card strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
  color: var(--rose-deep);
}

.category-card ul {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  padding-top: 16px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bar-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bar {
  width: 100%;
  max-width: 82px;
  border-radius: 24px 24px 10px 10px;
  background: linear-gradient(180deg, rgba(220, 125, 152, 0.95), rgba(255, 190, 145, 0.9));
  box-shadow: inset 0 -10px 22px rgba(255, 255, 255, 0.22);
  position: relative;
  overflow: hidden;
}

.bar.green {
  background: linear-gradient(180deg, rgba(141, 196, 174, 0.95), rgba(202, 225, 212, 0.92));
}

.bar.sky {
  background: linear-gradient(180deg, rgba(151, 177, 233, 0.95), rgba(223, 232, 251, 0.92));
}

.bar.gold {
  background: linear-gradient(180deg, rgba(225, 183, 101, 0.92), rgba(244, 221, 178, 0.92));
}

.bar.lavender {
  background: linear-gradient(180deg, rgba(170, 142, 228, 0.92), rgba(236, 229, 255, 0.96));
}

.bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 48%);
}

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

.bar-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--rose-deep);
  text-align: center;
}

.bar-pct {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.bar-count {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.ring-wrap {
  display: grid;
  place-items: center;
  gap: 18px;
  min-height: 250px;
}

.ring {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background:
    conic-gradient(
      var(--rose) 0 34%,
      #8dc4ae 34% 54%,
      #97b1e9 54% 72%,
      #f0c781 72% 86%,
      #e7e0f8 86% 100%
    );
  position: relative;
  box-shadow: inset 0 0 0 12px rgba(255, 255, 255, 0.2);
}

.ring::after {
  content: "";
  position: absolute;
  inset: 38px;
  background: rgba(255, 255, 255, 0.93);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(232, 210, 200, 0.28);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
  text-align: center;
}

.ring-center strong {
  display: block;
  font-size: 34px;
  color: var(--rose-deep);
}

.legend {
  display: grid;
  gap: 10px;
  width: 100%;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.legend-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.table-scroller {
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid rgba(222, 184, 168, 0.16);
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: rgba(255, 255, 255, 0.8);
}

thead th {
  text-align: left;
  padding: 16px 18px;
  font-size: 13px;
  color: var(--rose-deep);
  background: rgba(255, 243, 246, 0.92);
  border-bottom: 1px solid rgba(216, 171, 183, 0.2);
  letter-spacing: 0.02em;
}

tbody td {
  padding: 18px;
  border-bottom: 1px solid rgba(230, 214, 206, 0.56);
  vertical-align: top;
}

tbody tr:hover {
  background: rgba(255, 249, 251, 0.84);
}

.item-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.amount {
  font-weight: 700;
  color: var(--rose-deep);
  font-size: 18px;
}

.split-lines {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.pill {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(231, 209, 198, 0.36);
  color: var(--muted);
}

.pill.medical {
  background: rgba(250, 237, 207, 0.95);
  color: #956d1f;
}

.pill.mother {
  background: rgba(255, 235, 240, 0.92);
  color: var(--rose-deep);
}

.pill.baby {
  background: rgba(229, 243, 235, 0.95);
  color: var(--mint-deep);
}

.pill.voucher {
  background: rgba(237, 241, 254, 0.95);
  color: var(--sky-deep);
}

.pill.store {
  background: rgba(245, 239, 221, 0.95);
  color: #8a6a2d;
}

.mobile-ledger-list {
  display: none;
}

.mobile-ledger-amount {
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
}

.mobile-ledger-meta {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.config-card h3 {
  font-size: 24px;
}

.config-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.config-list {
  margin-top: 16px;
}

.config-chip {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(231, 209, 198, 0.36);
  color: var(--muted);
}

.config-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 16px;
}

.config-form input {
  border: 1px solid rgba(218, 179, 164, 0.22);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  outline: none;
}

.config-form button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(219, 126, 153, 0.92), rgba(245, 180, 143, 0.94));
  color: #fff;
  cursor: pointer;
}

.budget-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(232, 215, 205, 0.42);
}

.budget-card strong {
  display: block;
  margin-top: 8px;
  color: var(--rose-deep);
  font-size: 22px;
}

.insight-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  color: var(--rose-deep);
}

.mobile-preview {
  display: grid;
  gap: 18px;
}

.mobile-shell {
  width: min(100%, 340px);
  margin: 0 auto;
  border-radius: 34px;
  padding: 12px;
  background: linear-gradient(180deg, #3f3432 0%, #211c1b 100%);
  box-shadow: 0 18px 34px rgba(42, 30, 28, 0.28);
}

.mobile-screen {
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 214, 221, 0.66), transparent 28%),
    linear-gradient(180deg, #fffaf6 0%, #fff7f0 100%);
  padding: 16px 16px 18px;
  min-height: 620px;
}

.mobile-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.mobile-title {
  margin-top: 14px;
  font-size: 22px;
  line-height: 1.22;
}

.mobile-overview {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mobile-card,
.mobile-record,
.mobile-actions {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(232, 212, 201, 0.4);
}

.mobile-card {
  padding: 14px;
}

.mobile-card strong {
  display: block;
  margin-top: 6px;
  color: var(--rose-deep);
  font-size: 20px;
}

.mobile-actions {
  margin-top: 12px;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.mobile-action {
  padding: 12px 8px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 242, 244, 0.95), rgba(255, 255, 255, 0.95));
}

.mobile-list {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.mobile-record {
  padding: 14px;
}

.mobile-record-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
}

.mobile-record strong {
  color: var(--rose-deep);
}

.mobile-bottom-nav {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.mobile-bottom-nav .active {
  color: var(--rose-deep);
  font-weight: 700;
}

.footer-note {
  line-height: 1.8;
  color: var(--muted);
}

.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

.mobile-sticky-nav {
  display: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .hero,
  .page-grid,
  .stats-grid,
  .mine-grid,
  .charts {
    grid-template-columns: 1fr;
  }

  .hero-side {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-stats,
  .summary-stats,
  .settings-summary,
  .page-actions-grid,
  .filters-grid,
  .settings-grid,
  .budget-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .page {
    width: min(100% - 20px, 100%);
    margin: 16px auto 32px;
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .top-nav {
    display: none;
  }

  .config-chip {
    padding: 10px 14px;
    font-size: 14px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .hero,
  .section-card,
  .upload-panel,
  .recent-panel,
  .summary-card,
  .chart-card,
  .table-wrap,
  .config-card,
  .insight-card,
  .mobile-preview,
  .tip-card,
  .footer-note {
    padding: 18px;
    border-radius: 24px;
  }

  .hero-side,
  .filters-grid,
  .form-grid,
  .settings-grid,
  .category-grid,
  .budget-grid,
  .status-strip,
  .mobile-overview {
    grid-template-columns: 1fr;
  }

  .config-form {
    grid-template-columns: 1fr auto;
  }

  .home-stats,
  .summary-stats,
  .settings-summary {
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 78%);
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }

  .page-actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-links,
  .chip-row,
  .inline-metrics {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .nav-links a,
  .filter-chip,
  .pill,
  .config-chip {
    flex: 0 0 auto;
  }

  .home-stats::-webkit-scrollbar,
  .summary-stats::-webkit-scrollbar,
  .settings-summary::-webkit-scrollbar,
  .nav-links::-webkit-scrollbar,
  .chip-row::-webkit-scrollbar,
  .inline-metrics::-webkit-scrollbar,
  .bars::-webkit-scrollbar {
    display: none;
  }

  .stat-card {
    scroll-snap-align: start;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-pill {
    width: 100%;
    white-space: normal;
  }

  .button-row .button {
    width: 100%;
  }

  .recent-item-head,
  .summary-row,
  .mobile-ledger-head,
  .config-inline-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .bars {
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .bar {
    max-width: 56px;
  }

  .bar-col {
    min-width: 72px;
  }

  .ring {
    width: 184px;
    height: 184px;
  }

  .ring::after {
    inset: 30px;
  }

  .table-scroller {
    display: none;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only,
  .mobile-ledger-list {
    display: grid;
  }

  .mobile-sticky-nav {
    position: fixed;
    left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(calc(100% - 20px), 420px);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(231, 209, 198, 0.5);
    box-shadow: 0 16px 30px rgba(76, 52, 45, 0.16);
    backdrop-filter: blur(14px);
    z-index: 12;
  }

  .mobile-sticky-nav a {
    text-decoration: none;
    text-align: center;
    padding: 12px 10px;
    border-radius: 14px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
  }

  .mobile-sticky-nav a.active {
    color: var(--rose-deep);
    background: linear-gradient(135deg, rgba(255, 242, 244, 0.98), rgba(255, 255, 255, 0.96));
  }
}

@media (max-width: 820px) {
  .ledger-filter-bar input[type="date"] {
    flex: 1;
    min-width: 130px;
  }

  .filter-sep {
    display: none;
  }
}

@media (max-width: 560px) {
  .hero h1 {
    font-size: 28px;
  }

  .hero p,
  .stat-card small,
  .recent-item p,
  .summary-card p,
  .category-card ul,
  .config-card p,
  .tip-card p,
  .insight-card p,
  .field-hint {
    font-size: 12px;
  }

  .page-actions-grid {
    grid-template-columns: 1fr;
  }

  .mobile-overview {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── 行内操作按钮 ─────────────────────────────────────────────────────────── */
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.action-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px 11px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.12s ease;
}

.action-btn:active {
  transform: scale(0.96);
}

.action-btn.edit {
  background: rgba(236, 242, 255, 0.9);
  color: var(--sky-deep);
  border-color: rgba(151, 177, 233, 0.3);
}

.action-btn.edit:hover {
  background: rgba(151, 177, 233, 0.28);
}

.action-btn.delete {
  background: rgba(255, 235, 238, 0.9);
  color: var(--rose-deep);
  border-color: rgba(219, 126, 153, 0.3);
}

.action-btn.delete:hover {
  background: rgba(219, 126, 153, 0.22);
}

/* ── 编辑弹窗 ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(70, 45, 40, 0.38);
  backdrop-filter: blur(5px);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: rise 0.2s ease-out both;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.84);
  box-shadow: 0 28px 60px rgba(80, 50, 45, 0.26);
  border-radius: var(--radius-xl);
  width: min(580px, 100%);
  max-height: 92vh;
  overflow-y: auto;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(220, 182, 168, 0.2);
}

.modal-head h3 {
  font-size: 18px;
  color: var(--rose-deep);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 8px;
}

.modal-close:hover {
  color: var(--rose-deep);
  background: rgba(255, 235, 240, 0.7);
}

.modal-body {
  padding: 20px 24px;
}

.modal-foot {
  display: flex;
  gap: 12px;
  padding: 16px 24px 22px;
  border-top: 1px solid rgba(220, 182, 168, 0.18);
}

.modal-msg {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid transparent;
}

.modal-msg-ok {
  background: #ecfdf3;
  color: #25603d;
  border-color: #abefc6;
}

.modal-msg-error {
  background: #fef3f2;
  color: #b42318;
  border-color: #fecdca;
}

@media (max-width: 820px) {
  .modal-card {
    border-radius: 24px;
    max-height: 96vh;
  }

  .modal-head,
  .modal-body,
  .modal-foot {
    padding-left: 18px;
    padding-right: 18px;
  }
}

.chip-delete {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 0 0 5px;
  opacity: 0.5;
  vertical-align: middle;
}
.chip-delete:hover {
  opacity: 1;
  color: var(--rose);
}

.stats-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 4px 10px;
}

.stats-tab-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.stats-tab {
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid rgba(230, 210, 200, 0.36);
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.stats-tab.active {
  background: linear-gradient(135deg, rgba(255, 240, 244, 0.96), rgba(255, 255, 255, 0.98));
  border-color: rgba(219, 126, 153, 0.26);
  color: var(--rose-deep);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 22px;
  margin-top: 16px;
  animation: rise 0.3s ease-out both;
}

.ledger-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
}

.ledger-filter-bar select,
.ledger-filter-bar input[type="text"],
.ledger-filter-bar input[type="date"] {
  border: 1px solid rgba(218, 179, 164, 0.22);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 10px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ledger-filter-bar select:focus,
.ledger-filter-bar input:focus {
  border-color: rgba(220, 125, 152, 0.45);
  box-shadow: 0 0 0 3px rgba(220, 125, 152, 0.1);
}

.ledger-filter-bar input[type="text"] {
  flex: 1;
  min-width: 160px;
}

.filter-sep {
  font-size: 13px;
  flex-shrink: 0;
  user-select: none;
}

.stats-page-header h2 {
  font-size: 20px;
  color: var(--rose-deep);
}

.stats-meta-chips {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--muted);
}

.stats-meta-chips strong {
  color: var(--rose-deep);
  font-size: 15px;
}

@media (max-width: 560px) {
  .stats-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .stats-meta-chips {
    gap: 14px;
    font-size: 13px;
    flex-wrap: wrap;
  }
}

/* ── 统计页移动端适配（覆盖通用 mobile 横滑） ───────────── */
@media (max-width: 820px) {
  .summary-stats {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: visible;
    gap: 12px;
  }

  .summary-stats .stat-card {
    scroll-snap-align: none;
    padding: 14px 16px;
  }

  .summary-stats .stat-card strong {
    margin-top: 10px;
    font-size: 22px;
  }

  /* 第 5 张卡（券抵扣）独占一行 */
  .summary-stats .stat-card:nth-child(5):last-child {
    grid-column: 1 / -1;
  }

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

  .stats-tab-nav {
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .stats-tab-nav::-webkit-scrollbar { display: none; }
  .stats-tab { flex-shrink: 0; padding: 8px 16px; font-size: 13px; }

  .ledger-filter-bar {
    padding: 12px 14px;
    border-radius: 22px;
  }
  .ledger-filter-bar select,
  .ledger-filter-bar input[type="text"],
  .ledger-filter-bar input[type="date"] {
    padding: 10px 12px;
    font-size: 14px;
  }

  .mobile-ledger-card {
    padding: 14px;
    border-radius: 16px;
  }

  .mobile-ledger-head {
    align-items: center;
    flex-direction: row;
  }

  .mobile-ledger-amount {
    font-size: 17px;
  }
}

@media (max-width: 480px) {
  .summary-stats .stat-card strong {
    font-size: 20px;
  }
  .summary-stats .stat-card .label {
    font-size: 13px;
  }
}
