:root {
  --paper: #f5efe6;
  --paper-raised: #fffdf8;
  --paper-soft: #f0e6d8;
  --ink: #2b2119;
  --ink-soft: #796a5d;
  --line: #e5d8c8;
  --terracotta: #b95f2a;
  --terracotta-dark: #7d3d1d;
  --terracotta-soft: #f6e2d3;
  --sage: #bc8d73;
  --slate-blue: #8b8da0;
  --sand: #c59d62;
  --success: #8a5e38;
  --warn-bg: #fff3dc;
  --warn-line: #dfbd7b;
  --radius-card: 2px;
  --radius-control: 4px;
  --shadow-card: none;
  --shadow-float: none;
  --duration-fast: 180ms;
  --duration-base: 240ms;
  --bg: var(--paper);
  --panel: var(--paper);
  --card: var(--paper-raised);
  --surface-soft: var(--paper-soft);
  --surface-raised: var(--paper-raised);
  --muted: var(--ink-soft);
  --primary: var(--terracotta);
  --primary-dark: var(--terracotta-dark);
  --primary-soft: var(--terracotta-soft);
}

body {
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.app {
  width: min(100%, 520px);
  background: var(--paper-raised);
  box-shadow: none;
}

.screen {
  padding: 30px 24px calc(96px + env(safe-area-inset-bottom));
}

.stack { gap: 22px; }

.eyebrow,
.section-kicker {
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

h1,
h2,
.page-heading h3,
.home-ledger-header h2 {
  font-family: inherit;
  font-weight: 700;
  letter-spacing: -0.025em;
}

h1 { font-size: clamp(32px, 8vw, 44px); }
h2 { font-size: 30px; }
h3 { font-size: 17px; }

.card,
.hero-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.card { padding: 0; }

.home-ledger-header {
  min-height: 0;
  align-items: end;
  border-bottom: 1px solid var(--ink);
  padding: 0 0 18px;
}

.home-ledger-header h2 {
  margin: 7px 0 0;
  font-size: clamp(34px, 8vw, 48px);
  line-height: 1.1;
}

.member-chip,
.topbar .secondary-btn {
  min-height: 36px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.monthly-overview-card {
  overflow: visible;
  border: 0;
  border-radius: 0;
  padding: 3px 0 0;
  background: transparent;
  box-shadow: none;
}

.monthly-overview-card::before { display: none; }

.hero-amount {
  margin: 10px 0 28px;
  font-family: inherit;
  font-size: clamp(58px, 15vw, 82px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.overview-breakdown {
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.overview-breakdown div {
  gap: 7px;
  padding: 16px 8px 18px 0;
}

.overview-breakdown div + div { padding-left: 15px; border-left: 1px solid var(--line); }
.overview-breakdown dt { font-size: 11px; letter-spacing: 0.08em; }
.overview-breakdown dd { font-family: inherit; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.entry-launcher {
  min-height: 68px;
  border: 0;
  border-radius: 2px;
  padding: 13px 17px;
  background: var(--primary-dark);
  box-shadow: none;
}

.entry-launcher:hover,
.entry-launcher:focus-visible { background: #663019; box-shadow: none; }
.entry-launcher-icon { width: 33px; height: 33px; border-radius: 50%; }
.entry-launcher-copy strong { font-size: 15px; font-weight: 650; }
.entry-launcher-copy small { color: #f6e7dd; font-size: 11px; }

.attention-list {
  border: 0;
  border-left: 2px solid var(--sage);
  border-radius: 0;
  padding: 10px 0 2px 18px;
  background: #fff3e3;
}

.attention-list .section-kicker { margin-bottom: 10px; }
.attention-row { border-top-color: #ead4b9; font-size: 13px; }
.attention-row:hover { color: var(--primary-dark); }

.recent-expenses-card,
.detail-month-rows,
.settings-summary {
  padding: 0;
  background: transparent;
}

.recent-expenses-card .balance-title,
.section-head {
  border-bottom: 1px solid var(--ink);
  padding: 0 0 14px;
}

.recent-expenses-card h3,
.section-head h3 { margin: 0; font-family: inherit; font-size: 20px; }

.expense-row { padding: 17px 0; border-bottom-color: var(--line); }
.expense-category-mark { border-radius: 50%; background: #f6e2d3; color: var(--primary-dark); }
.expense-row-purpose { font-size: 15px; font-weight: 650; }
.expense-row-amount { font-family: inherit; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

.empty {
  border: 0;
  border-radius: 0;
  padding: 24px 0;
  background: transparent;
  color: var(--ink-soft);
  line-height: 1.7;
}

.empty-with-action { gap: 14px; }

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  border-radius: 3px;
  box-shadow: none;
}

.primary-btn { background: var(--primary-dark); }
.primary-btn:hover { background: #663019; box-shadow: none; }
.secondary-btn { background: var(--terracotta-soft); color: var(--primary-dark); }
.ghost-btn { border: 1px solid var(--line); background: transparent; }
.ghost-btn:hover { background: var(--paper-soft); }

.input,
.select,
.textarea,
.candidate-btn {
  border-radius: 3px;
  background: var(--paper-raised);
}

.page-heading {
  min-height: 0;
  border-bottom: 1px solid var(--ink);
  padding: 4px 0 21px;
}

.page-heading h3 { margin: 6px 0 0; font-size: clamp(30px, 8vw, 40px); line-height: 1.2; }
.page-heading-icon { display: none; }

.topbar { min-height: 42px; padding: 0; }
.topbar h2 { font-size: 19px; font-family: inherit; font-weight: 600; }
.topbar .eyebrow { margin-bottom: 2px; }

.detail-month-header { background: var(--paper-raised); border-bottom: 1px solid var(--line); }
.detail-month-header h3 { font-family: inherit; font-size: 21px; }
.details-toolbar { margin-top: 6px; }
.details-filter-form { border-top: 1px solid var(--line); padding-top: 18px; }

.balance-page > article.card {
  border-top: 1px solid var(--ink);
  padding: 20px 0 10px;
}

.balance-page .balance-title h3 { font-family: inherit; font-size: 21px; }
.balance-page .hero-amount { margin: 0; font-size: 34px !important; }
.balance-history { border-top-color: var(--line); }

.report-page > article.card,
.report-page > .stack > article.card {
  border-top: 1px solid var(--ink);
  padding: 20px 0 24px;
}

.report-card {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 0;
  background: transparent;
}

.report-card-primary { border-top-color: var(--primary-dark); background: transparent; }
.report-card strong { font-family: inherit; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.report-narrative { border-radius: 0; border-left-color: var(--sage); background: #fff8f0; }
.monthly-trend-chart { border-radius: 0; background: transparent; }
.report-note { border-radius: 0; background: transparent; }
.report-highlight { border-radius: 0; background: #f9eae0; }

.settings-summary { border-top: 1px solid var(--ink); }
.settings-destination {
  min-height: 78px;
  border-bottom: 1px solid var(--line);
  padding: 15px 2px;
}
.settings-destination:hover { background: #f7ede2; }
.settings-destination strong { font-family: inherit; font-size: 19px; font-weight: 650; }
.settings-destination small { font-size: 12px; }

.bottom-nav { padding: 0; }
.nav-wordmark { display: none; }
.bottom-nav .nav {
  width: min(100%, 520px);
  min-height: 62px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 12px calc(4px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 248, 0.97);
  box-shadow: none;
  backdrop-filter: none;
}

.tab-btn { border-radius: 0; color: var(--ink-soft); font-weight: 600; }
.tab-btn.active { color: var(--primary-dark); }
.tab-btn.active::after { background: var(--primary-dark); }

.expense-sheet,
.confirm-dialog {
  border-radius: 10px 10px 0 0;
  background: var(--paper-raised);
}
.confirm-dialog { border-radius: 4px; }
.expense-sheet .conversation-card { border: 0; }

@media (max-width: 359px) {
  .screen { padding-right: 17px; padding-left: 17px; }
  .overview-breakdown dd { font-size: 15px; }
}

@media (max-width: 340px) {
  .overview-breakdown { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 700px) {
  body { padding: 0; }
  .app { width: min(100%, 1140px); border: 0; border-radius: 0; overflow: visible; }
  .screen { width: 100%; padding: 44px 58px 100px; }
  .entry-screen { max-width: 900px; }
  .entry-launcher { max-width: 360px; }
  .bottom-nav { right: 0; bottom: 0; left: 0; }
  .bottom-nav .nav { width: min(100%, 1140px); }
}

@media (min-width: 1000px) {
  .screen { padding: 136px 68px 100px; }
  .screen > .stack { max-width: none; }
  .topbar { justify-content: flex-end; margin-bottom: 12px; border: 0; }
  .topbar > div:first-child { display: none; }
  .bottom-nav {
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
    height: 92px;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 253, 248, 0.97);
    overflow: visible;
    pointer-events: auto;
  }
  .nav-wordmark {
    display: block;
    position: absolute;
    top: 25px;
    left: max(calc((100vw - 1004px) / 2), 68px);
    color: var(--ink);
    font-family: inherit;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.06em;
  }
  .bottom-nav .nav {
    width: min(calc(100% - 136px), 1004px);
    height: 91px;
    justify-content: flex-end;
    gap: 28px;
    border: 0;
    padding: 0;
    background: transparent;
  }
  .tab-btn { flex: 0 0 auto; min-height: 50px; padding: 12px 0; font-size: 13px; }
  .tab-btn .nav-icon { display: none; }
  .tab-btn.active::after { right: 0; bottom: 7px; left: 0; height: 1px; }
  .home-page { grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 26px 72px; }
  .home-ledger-header { grid-column: 1 / -1; padding-bottom: 26px; }
  .home-ledger-header h2 { font-size: 54px; }
  .monthly-overview-card { grid-column: 1; }
  .monthly-overview-card .hero-amount { font-size: 88px; }
  .recent-expenses-card { grid-column: 2; grid-row: 2 / span 3; align-self: start; padding: 0; }
  .entry-launcher,
  .attention-list { grid-column: 1; }
  .entry-launcher { max-width: 360px; }
  .details-page { max-width: 860px; }
  .details-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .balance-page { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 58px; }
  .balance-page > .page-heading,
  .balance-page > .balance-title,
  .balance-page > form { grid-column: 1 / -1; }
  .report-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .annual-report-details,
  .report-page > .stack > article.card.stack { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 48px; }
  .report-page > .stack > article.card.stack > :is(.month-toggle, section:first-of-type, .report-core-metrics) { grid-column: 1 / -1; }
  .settings-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .entry-launcher,
  .attention-row,
  .settings-destination { transform: none !important; }
}
