:root {
  --bg: #f7f5ef;
  --surface: #ffffff;
  --surface-soft: #f0eee6;
  --ink: #18332a;
  --ink-soft: #65746e;
  --line: #e4e2d9;
  --brand: #1b4331;
  --brand-2: #2f6b50;
  --accent: #f4c95d;
  --danger: #c74444;
  --shadow: 0 14px 40px rgba(30, 49, 40, 0.08);
  --shadow-small: 0 6px 18px rgba(30, 49, 40, 0.07);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --header-height: 68px;
  --nav-height: 72px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(244, 201, 93, 0.2), transparent 26rem),
    linear-gradient(180deg, #fbfaf6 0%, var(--bg) 48%);
  color: var(--ink);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button,
label,
input {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
label:focus-within {
  outline: 3px solid rgba(47, 107, 80, 0.2);
  outline-offset: 2px;
}

button:active {
  transform: translateY(1px);
}

[hidden] {
  display: none !important;
}

svg {
  display: block;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 20px);
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: calc(var(--header-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 18px 0;
  background: rgba(247, 245, 239, 0.9);
  border-bottom: 1px solid rgba(228, 226, 217, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0;
  color: var(--ink);
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  color: var(--accent);
  background: var(--brand);
  border-radius: 12px;
  box-shadow: 0 5px 14px rgba(27, 67, 49, 0.2);
}

.brand-mark svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.brand > span:last-child {
  display: grid;
  line-height: 1.15;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0.02em;
}

.brand small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10px;
}

.icon-button {
  display: grid;
  width: 46px;
  height: 46px;
  padding: 0;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 15px;
  cursor: pointer;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.main-content {
  width: min(100%, 1060px);
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.view {
  animation: view-in 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(228, 226, 217, 0.9);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-small);
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 318px;
  padding: 30px 24px 26px;
  color: #fff;
  background:
    radial-gradient(circle at 90% 18%, rgba(244, 201, 93, 0.18), transparent 10rem),
    linear-gradient(145deg, #173c2c 0%, #24563f 100%);
  border-radius: var(--radius-xl);
  box-shadow: 0 18px 45px rgba(23, 60, 44, 0.22);
}

.home-hero::after {
  position: absolute;
  right: -40px;
  bottom: -65px;
  width: 190px;
  height: 190px;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 540px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--brand-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero-card .eyebrow,
.eyebrow.light {
  color: #f4cf73;
}

.hero-card h1 {
  margin: 0;
  font-size: clamp(32px, 10vw, 54px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.hero-card h1 span {
  color: #f4c95d;
}

.hero-copy > p:last-child {
  max-width: 29rem;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  line-height: 1.75;
}

.hero-illustration {
  position: absolute;
  right: 12px;
  bottom: 4px;
  width: 145px;
  height: 130px;
  opacity: 0.96;
}

.receipt {
  position: absolute;
  right: 18px;
  bottom: -4px;
  display: grid;
  width: 92px;
  height: 112px;
  padding: 20px 15px;
  align-content: start;
  gap: 11px;
  background: #f9f6ec;
  border-radius: 8px 8px 3px 3px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  transform: rotate(5deg);
}

.receipt::after {
  position: absolute;
  right: 0;
  bottom: -8px;
  left: 0;
  height: 14px;
  content: "";
  background: linear-gradient(135deg, transparent 7px, #f9f6ec 0) 0 0 / 14px 14px repeat-x;
}

.receipt span {
  height: 5px;
  background: #ced7d1;
  border-radius: 99px;
}

.receipt span:nth-child(2) { width: 70%; }
.receipt span:nth-child(3) { width: 86%; }
.receipt span:nth-child(4) { width: 52%; }

.coin {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  color: #5e4711;
  font-weight: 900;
  background: linear-gradient(145deg, #ffe596, #eebf42);
  border: 2px solid rgba(255, 245, 195, 0.7);
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.coin-one {
  top: 11px;
  left: 5px;
  width: 46px;
  height: 46px;
  font-size: 18px;
  transform: rotate(-14deg);
}

.coin-two {
  top: 45px;
  right: 2px;
  width: 32px;
  height: 32px;
  font-size: 13px;
  transform: rotate(14deg);
}

.date-panel,
.month-preview-panel,
.entry-panel,
.records-panel,
.day-category-panel,
.chart-panel,
.monthly-category-panel,
.data-panel {
  margin-top: 18px;
  padding: 20px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.section-heading.compact {
  align-items: center;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.section-kicker {
  margin-bottom: 5px;
}

.today-badge,
.record-count,
.chart-caption {
  flex: 0 0 auto;
  padding: 6px 9px;
  color: var(--brand-2);
  background: #edf4ee;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

.date-field {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.date-field > span,
.input-field > span,
.category-picker legend,
.month-selector > span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.date-field input,
.input-field input,
.month-selector input {
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  color: var(--ink);
  background: #fbfaf6;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: 0;
  font-size: 16px;
  font-weight: 650;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
  -webkit-appearance: none;
}

.date-field input:focus,
.input-field input:focus,
.month-selector input:focus {
  background: #fff;
  border-color: rgba(47, 107, 80, 0.65);
  box-shadow: 0 0 0 4px rgba(47, 107, 80, 0.09);
}

.quick-dates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 18px;
}

.quick-dates button {
  min-height: 44px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.quick-dates button.active {
  color: var(--brand);
  background: #e7f0e9;
  border-color: #c7d9cc;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 20px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
  box-shadow: 0 10px 22px rgba(27, 67, 49, 0.18);
}

.primary-button:active {
  background: #143726;
}

.primary-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.secondary-button {
  min-height: 46px;
  color: var(--brand);
  background: #f8faf7;
  border: 1px solid #d8e1d9;
  font-size: 13px;
}

.text-button {
  min-height: 42px;
  padding: 0 4px;
  color: var(--brand-2);
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.home-month-stats {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 3px;
  margin-top: 18px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.home-month-stats > div {
  display: grid;
  min-width: 0;
  padding: 14px 11px;
  gap: 6px;
  background: #fbfaf6;
}

.home-month-stats span {
  color: var(--ink-soft);
  font-size: 10px;
}

.home-month-stats strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-strip {
  margin-top: 20px;
}

.category-strip > p {
  margin: 0 0 10px 4px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

#homeCategoryStrip {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 1px 1px 4px;
  scrollbar-width: none;
}

#homeCategoryStrip::-webkit-scrollbar {
  display: none;
}

.category-pill {
  display: inline-flex;
  min-width: max-content;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 14px 0 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  box-shadow: 0 3px 10px rgba(30, 49, 40, 0.04);
  font-size: 12px;
  font-weight: 700;
}

.category-pill i,
.category-icon,
.legend-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  background: var(--category-color);
  border-radius: 50%;
}

.day-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.back-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 4px;
  padding: 0 9px 0 4px;
  color: var(--brand-2);
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.back-button svg,
.day-switcher svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.day-switcher {
  display: flex;
  gap: 7px;
}

.day-switcher button {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: var(--brand);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
}

.day-summary-card {
  position: relative;
  display: flex;
  min-height: 174px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  overflow: hidden;
  padding: 24px 21px;
  color: #fff;
  background: linear-gradient(135deg, #193f2e, #2d654b);
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 36px rgba(23, 60, 44, 0.18);
}

.day-summary-card::after {
  position: absolute;
  right: -50px;
  bottom: -100px;
  width: 210px;
  height: 210px;
  content: "";
  background: rgba(244, 201, 93, 0.08);
  border: 34px solid rgba(244, 201, 93, 0.08);
  border-radius: 50%;
}

.day-summary-card > * {
  position: relative;
  z-index: 1;
}

.day-summary-card h1 {
  margin: 0;
  font-size: 31px;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.day-summary-card p:last-child {
  max-width: 15rem;
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  line-height: 1.5;
}

.day-total {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 6px;
  text-align: right;
}

.day-total span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
}

.day-total strong {
  color: var(--accent);
  font-size: clamp(22px, 7vw, 31px);
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.category-picker {
  min-width: 0;
  margin: 18px 0 16px;
  padding: 0;
  border: 0;
}

.category-picker legend {
  margin-bottom: 10px;
}

.category-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  padding: 1px 1px 7px;
}

.category-options::-webkit-scrollbar {
  display: none;
}

.category-option {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 78px;
  align-content: center;
  justify-items: center;
  gap: 6px;
  padding: 5px 2px;
  color: var(--ink-soft);
  background: #f8f7f2;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: 180ms ease;
}

.category-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.category-option:has(input:checked) {
  color: var(--category-color);
  background: color-mix(in srgb, var(--category-color) 8%, white);
  border-color: color-mix(in srgb, var(--category-color) 45%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--category-color) 20%, white);
}

.category-option .category-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  font-size: 16px;
  background: var(--category-color);
  border-radius: 11px;
}

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

.input-field {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.input-field.wide {
  grid-column: 1 / -1;
}

.input-field input {
  min-height: 52px;
}

.money-input {
  position: relative;
  display: flex;
  align-items: center;
}

.money-input b {
  position: absolute;
  z-index: 1;
  left: 14px;
  color: var(--ink-soft);
  font-size: 15px;
  pointer-events: none;
}

.money-input input {
  padding-left: 34px;
}

.form-message {
  min-height: 18px;
  margin: 9px 2px 2px;
  color: var(--danger);
  font-size: 12px;
}

.records-list {
  display: grid;
  gap: 9px;
  margin-top: 15px;
}

.record-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  min-height: 68px;
  padding: 11px 9px 11px 12px;
  background: #fbfaf6;
  border: 1px solid #ece9df;
  border-radius: 16px;
}

.record-category-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: var(--category-color);
  border-radius: 12px;
  font-size: 17px;
}

.record-info {
  min-width: 0;
}

.record-info strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-info span {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 10px;
}

.record-amount {
  font-size: 15px;
  font-weight: 850;
  white-space: nowrap;
}

.record-delete {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: #9ea6a2;
  background: transparent;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
}

.record-delete:active {
  color: var(--danger);
  background: #fff0f0;
}

.record-delete svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.empty-state {
  display: grid;
  min-height: 176px;
  place-items: center;
  padding: 26px 18px;
  color: var(--ink-soft);
  text-align: center;
  border: 1px dashed #d9d7cf;
  border-radius: 18px;
}

.empty-state .empty-icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 11px;
  place-items: center;
  color: var(--brand-2);
  background: #edf3ee;
  border-radius: 17px;
  font-size: 23px;
}

.empty-state strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.empty-state p {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.5;
}

.category-total-list,
.monthly-category-list,
.pie-legend {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.category-total-row,
.monthly-category-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 53px;
  padding: 8px 3px;
  border-bottom: 1px solid #efede7;
}

.category-total-row:last-child,
.monthly-category-row:last-child {
  border-bottom: 0;
}

.category-total-row i {
  width: 9px;
  height: 9px;
  background: var(--category-color);
  border-radius: 50%;
}

.category-total-row span,
.monthly-category-name {
  min-width: 0;
}

.category-total-row span strong,
.monthly-category-name strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-total-row span small,
.monthly-category-name small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10px;
}

.category-total-row b,
.monthly-category-amount {
  font-size: 14px;
}

.report-heading {
  padding: 12px 2px 2px;
}

.report-heading h1 {
  margin: 0;
  font-size: clamp(30px, 9vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.045em;
}

.report-heading > div > p:last-child {
  margin: 11px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.month-selector {
  display: grid;
  gap: 7px;
  margin-top: 20px;
}

.month-selector input {
  min-height: 50px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.stat-card {
  display: grid;
  min-height: 105px;
  align-content: space-between;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-small);
}

.stat-card.primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.stat-card span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.stat-card.primary span {
  color: rgba(255, 255, 255, 0.65);
}

.stat-card strong {
  overflow: hidden;
  font-size: 24px;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card small {
  color: var(--ink-soft);
  font-size: 9px;
}

.stat-card.primary small {
  color: rgba(255, 255, 255, 0.52);
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 270px;
  margin-top: 16px;
  overflow: hidden;
}

.chart-wrap canvas,
.pie-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-note {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.6;
}

.pie-layout {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.pie-wrap {
  width: min(100%, 260px);
  height: 260px;
  margin: 0 auto;
}

.pie-legend {
  margin-top: 0;
}

.legend-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  font-size: 11px;
}

.legend-row .legend-dot {
  width: 9px;
  height: 9px;
}

.legend-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-row strong {
  font-size: 11px;
}

.monthly-category-row {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  min-height: 64px;
}

.monthly-category-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: var(--category-color);
  border-radius: 12px;
  font-size: 17px;
}

.monthly-category-percent {
  min-width: 38px;
  color: var(--ink-soft);
  font-size: 10px;
  text-align: right;
}

.data-description {
  margin: 15px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.65;
}

.data-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 15px;
}

.file-button {
  width: 100%;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding: 7px max(12px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(12px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid rgba(222, 220, 211, 0.9);
  box-shadow: 0 -10px 28px rgba(25, 42, 34, 0.06);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.bottom-nav button {
  display: grid;
  min-width: 0;
  height: 58px;
  place-items: center;
  align-content: center;
  gap: 3px;
  color: #88928d;
  background: transparent;
  border: 0;
  border-radius: 15px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.bottom-nav button.active {
  color: var(--brand);
  background: #edf3ee;
}

.bottom-nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.nav-plus {
  display: grid;
  width: 39px;
  height: 30px;
  place-items: center;
  margin-bottom: -2px;
  color: #fff;
  background: var(--brand);
  border-radius: 11px;
  box-shadow: 0 5px 12px rgba(27, 67, 49, 0.22);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 50%;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 18px);
  max-width: calc(100vw - 32px);
  padding: 11px 15px;
  color: #fff;
  background: rgba(21, 46, 35, 0.94);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 10px);
  transition: 220ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(50%, 0);
}

@media (min-width: 700px) {
  .main-content {
    padding: 26px 24px 44px;
  }

  #dateView {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
    gap: 18px;
    align-items: start;
  }

  #dateView .date-panel {
    grid-column: 2;
    grid-row: 1;
    margin-top: 0;
  }

  #dateView .home-hero {
    grid-column: 1;
    grid-row: 1;
  }

  #dateView .month-preview-panel {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  #dateView .category-strip {
    grid-column: 1 / -1;
    margin-top: 2px;
  }

  .home-hero {
    min-height: 390px;
    padding: 46px 40px;
  }

  .hero-illustration {
    right: 26px;
    bottom: 14px;
    width: 180px;
    height: 156px;
  }

  .receipt {
    right: 28px;
    width: 108px;
    height: 132px;
  }

  .date-panel {
    padding: 26px;
  }

  .day-summary-card {
    min-height: 190px;
    padding: 31px 30px;
  }

  .day-summary-card h1 {
    font-size: 42px;
  }

  .entry-panel,
  .records-panel,
  .day-category-panel,
  .chart-panel,
  .monthly-category-panel,
  .data-panel {
    padding: 26px;
  }

  .record-item {
    grid-template-columns: auto minmax(0, 1fr) 120px 42px;
    padding-right: 13px;
  }

  .record-amount {
    text-align: right;
  }

  .report-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
  }

  .month-selector {
    min-width: 210px;
    margin-top: 0;
  }

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

  .chart-wrap {
    height: 330px;
  }

  .pie-layout {
    grid-template-columns: minmax(240px, 0.8fr) minmax(240px, 1.2fr);
    align-items: center;
  }

  .pie-wrap {
    margin: 0 auto;
  }

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

@media (min-width: 980px) {
  #dayView {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(310px, 0.75fr);
    gap: 18px;
    align-items: start;
  }

  #dayView .day-toolbar,
  #dayView .day-summary-card,
  #dayView .records-panel {
    grid-column: 1 / -1;
  }

  #dayView .entry-panel,
  #dayView .day-category-panel {
    margin-top: 0;
  }

  #dayView .entry-panel {
    grid-column: 1;
  }

  #dayView .day-category-panel {
    grid-column: 2;
    grid-row: 3;
  }

  .bottom-nav {
    right: 50%;
    left: auto;
    width: min(430px, calc(100% - 40px));
    border: 1px solid rgba(222, 220, 211, 0.9);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    transform: translateX(50%);
  }
}

@media (max-width: 390px) {
  .hero-card {
    min-height: 336px;
  }

  .hero-illustration {
    right: 4px;
    opacity: 0.86;
  }

  .day-summary-card {
    display: grid;
  }

  .day-total {
    justify-items: start;
    text-align: left;
  }

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

  .input-field.wide {
    grid-column: auto;
  }

  .record-item {
    gap: 8px;
  }

  .record-category-icon {
    width: 34px;
    height: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


.cloud-backup {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px dashed #d8e1d9;
}

.cloud-backup-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cloud-backup-heading h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 17px;
}

.cloud-status {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: #67736b;
  background: #eef2ed;
  font-size: 11px;
}

.cloud-status[data-state="ok"] {
  color: #1b6a4a;
  background: #e0f3e8;
}

.cloud-status[data-state="pending"] {
  color: #8b6413;
  background: #fff2ce;
}

.cloud-status[data-state="error"] {
  color: #a23c35;
  background: #fde8e5;
}

.cloud-key-label {
  display: block;
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 12px;
}

.cloud-key-input {
  width: 100%;
  min-height: 48px;
  margin-top: 7px;
  padding: 0 14px;
  border: 1px solid #d8e1d9;
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.cloud-key-input:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(27, 67, 49, 0.1);
}