:root {
  color-scheme: light;
  --bg: #f3efe8;
  --bg-deep: #efe3d5;
  --surface: rgba(255, 251, 246, 0.88);
  --surface-strong: #fffdf9;
  --text: #1f1c1a;
  --muted: #70665f;
  --line: rgba(58, 46, 37, 0.08);
  --accent: #e86f33;
  --accent-strong: #cb5223;
  --income: #1a8b61;
  --expense: #c8453b;
  --budget: #3757d6;
  --card-shadow: 0 18px 45px rgba(54, 37, 22, 0.08);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --font-sans: "Avenir Next", "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(232, 111, 51, 0.18), transparent 30%),
    radial-gradient(circle at 90% 8%, rgba(55, 87, 214, 0.14), transparent 28%),
    linear-gradient(180deg, #f8f5ef 0%, var(--bg) 46%, var(--bg-deep) 100%);
}

button,
input,
select {
  font: inherit;
}

.app-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.55), transparent 30%),
    linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.26) 100%);
  pointer-events: none;
}

.phone-frame {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 20px 14px 36px;
}

.app-shell {
  position: relative;
  border-radius: 42px;
}

.app-main {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(18px);
}

.gradient-card {
  background:
    linear-gradient(160deg, rgba(39, 31, 27, 0.92), rgba(64, 45, 28, 0.9)),
    linear-gradient(135deg, rgba(232, 111, 51, 0.22), transparent 60%);
  color: #fff9f2;
  border-color: rgba(255, 255, 255, 0.08);
}

.app-header {
  padding: 22px;
}

.header-row,
.section-title,
.budget-summary,
.hero-stats,
.mini-stats,
.import-tip-row,
.panel-head,
.progress-meta,
.record-item,
.record-side,
.record-main,
.export-actions {
  display: flex;
}

.header-row,
.section-title,
.budget-summary,
.panel-head,
.progress-meta,
.record-item {
  justify-content: space-between;
}

.header-row,
.section-title,
.budget-summary,
.progress-meta,
.record-item,
.panel-head {
  gap: 12px;
  align-items: center;
}

.hero-stats,
.mini-stats,
.export-actions,
.record-side,
.record-main {
  gap: 10px;
}

.hero-stats,
.mini-stats {
  margin-top: 18px;
  flex-wrap: wrap;
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: rgba(255, 243, 232, 0.72);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
}

.section-kicker {
  color: var(--accent-strong);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 2rem;
  line-height: 1;
}

h2 {
  font-size: 1.18rem;
}

.month-switcher {
  min-width: 128px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
}

.month-switcher span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: rgba(255, 243, 232, 0.72);
}

.month-switcher input {
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff9f2;
}

.hero-stat,
.mini-stats article {
  flex: 1;
  min-width: 120px;
  padding: 14px;
  border-radius: 22px;
}

.hero-stat {
  background: rgba(255, 255, 255, 0.08);
}

.mini-stats article {
  background: rgba(255, 255, 255, 0.6);
}

.hero-stat span,
.budget-summary p,
.mini-stats span,
.chart-legend span,
.bar-summary span,
.category-progress-item span,
.record-meta,
label span {
  color: var(--muted);
  font-size: 0.88rem;
}

.gradient-card .hero-stat span,
.gradient-card .budget-summary p {
  color: rgba(255, 243, 232, 0.72);
}

.hero-stat strong,
.budget-summary strong,
.mini-stats strong {
  display: block;
  margin-top: 4px;
}

.hero-stat strong {
  font-size: 1.2rem;
}

.budget-summary {
  margin-top: 18px;
  padding: 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
}

.quick-overview,
.charts-card,
.planner-card,
.actions-card,
.records-card {
  padding: 18px;
}

.import-tip-row {
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.import-status {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.import-status.is-success {
  color: var(--income);
}

.import-status.is-error {
  color: var(--expense);
}

.progress-card {
  margin-top: 16px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.6);
}

.progress-track {
  width: 100%;
  height: 12px;
  margin-top: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(38, 31, 28, 0.08);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f0a66e, var(--accent-strong));
  transition: width 0.28s ease;
}

.chart-grid {
  display: grid;
  gap: 14px;
}

.chart-panel {
  padding: 14px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.54);
}

.panel-head {
  margin-bottom: 10px;
}

.panel-head span {
  color: var(--muted);
  font-size: 0.86rem;
}

canvas {
  width: 100%;
  height: auto;
  display: block;
}

.chart-legend,
.bar-summary,
.category-progress-list,
.record-list {
  display: grid;
  gap: 10px;
}

.legend-item,
.bar-summary-item,
.category-progress-row {
  display: grid;
  gap: 6px;
}

.legend-item {
  grid-template-columns: 14px 1fr auto;
  align-items: center;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 999px;
}

.budget-grid,
.record-form {
  display: grid;
  gap: 12px;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(58, 46, 37, 0.12);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
}

input:focus,
select:focus {
  outline: 2px solid rgba(232, 111, 51, 0.2);
  border-color: rgba(232, 111, 51, 0.44);
}

.form-actions {
  grid-column: 1 / -1;
}

.primary-btn,
.ghost-btn,
.delete-btn,
.pill-switch-btn {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.primary-btn,
.pill-switch-btn.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff7f1;
  font-weight: 700;
}

.ghost-btn,
.delete-btn,
.pill-switch-btn {
  background: rgba(58, 46, 37, 0.08);
  color: var(--text);
}

.wide-btn,
.ghost-btn,
.primary-btn {
  width: 100%;
}

.export-actions .ghost-btn,
.export-actions .primary-btn {
  width: auto;
  padding: 0 16px;
}

.pill-switch {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 4px;
  gap: 6px;
  border-radius: 999px;
  background: rgba(58, 46, 37, 0.08);
  margin-bottom: 14px;
}

.hidden {
  display: none;
}

.category-progress-list {
  margin-top: 14px;
}

.category-progress-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.record-list.empty-state {
  min-height: 140px;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.4);
  border-radius: 20px;
}

.record-item {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(58, 46, 37, 0.08);
  background: rgba(255, 255, 255, 0.64);
}

.record-main {
  align-items: flex-start;
  flex-direction: column;
  flex: 1;
}

.record-side {
  align-items: end;
  flex-direction: column;
}

.record-type-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.record-type-tag.income {
  background: rgba(26, 139, 97, 0.12);
  color: var(--income);
}

.record-type-tag.expense {
  background: rgba(200, 69, 59, 0.12);
  color: var(--expense);
}

.record-amount.income {
  color: var(--income);
}

.record-amount.expense {
  color: var(--expense);
}

.delete-btn {
  padding: 0 14px;
}

@media (min-width: 880px) {
  .phone-frame {
    width: min(100%, 1080px);
    padding: 28px 20px 40px;
  }

  .app-main {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .app-header,
  .quick-overview,
  .records-card {
    grid-column: 1 / -1;
  }

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

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

@media (max-width: 520px) {
  .phone-frame {
    padding-inline: 10px;
  }

  .app-header,
  .quick-overview,
  .charts-card,
  .planner-card,
  .actions-card,
  .records-card {
    padding: 16px;
  }

  .header-row,
  .section-title,
  .budget-summary,
  .record-item,
  .import-tip-row {
    flex-direction: column;
    align-items: stretch;
  }

  .export-actions,
  .record-side {
    width: 100%;
  }

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