:root {
  --green: #1fbf70;
  --green-dark: #079a55;
  --bg: #f7f9f8;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #718096;
  --line: #e6edf0;
  --red: #ef4444;
  --shadow: 0 12px 30px rgba(15, 23, 42, .07);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

#app {
  min-height: 100vh;
}

.screen {
  min-height: 100vh;
  padding: max(28px, env(safe-area-inset-top)) 18px calc(104px + env(safe-area-inset-bottom));
}

.login {
  padding: max(54px, env(safe-area-inset-top)) 24px 24px;
}

.brand {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

.subtitle {
  margin: 8px 0 28px;
  color: var(--muted);
  font-size: 15px;
}

.card {
  background: var(--card);
  border: 1px solid #eef2f5;
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
  margin-bottom: 14px;
}

.hero {
  color: white;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  border: 0;
}

.title {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
}

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

.section-title {
  margin: 18px 2px 10px;
  font-size: 18px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin: 0 0 7px 2px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.input {
  width: 100%;
  height: 52px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #fcfdfd;
  color: var(--text);
  outline: none;
  padding: 0 15px;
}

.input::placeholder {
  color: #b9c3cf;
}

.btn {
  width: 100%;
  height: 50px;
  border-radius: 18px;
  font-weight: 800;
}

.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  box-shadow: 0 10px 22px rgba(31, 191, 112, .2);
}

.btn-secondary {
  color: var(--text);
  background: white;
  border: 1px solid #e2e8f0;
}

.btn-danger {
  color: var(--red);
  background: #fff8f8;
  border: 1px solid #fecaca;
}

.stack {
  display: grid;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

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

.metric strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
}

.hero .metric span,
.hero .metric strong {
  color: white;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
  margin-top: 12px;
}

.progress i {
  display: block;
  height: 100%;
  width: var(--value);
  border-radius: inherit;
  background: var(--color, var(--green));
}

.type-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  height: 58px;
  border-radius: 22px;
  background: #f0f7f3;
  border: 1px solid #dcebe1;
  margin-bottom: 14px;
}

.type-switch button {
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.type-switch button.active {
  color: white;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
}

.category-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 0 10px;
  scrollbar-width: none;
}

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

.pill {
  min-width: 112px;
  height: 48px;
  border-radius: 22px;
  color: var(--text);
  background: white;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .08);
  font-weight: 700;
}

.pill.active {
  color: white;
  border: 0;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
}

.category-actions {
  display: grid;
  grid-template-columns: 1fr 72px 72px;
  gap: 10px;
  margin: 2px 0 14px;
}

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

.entry {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
}

.icon-badge {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--green-dark);
  background: #ecfdf5;
  font-weight: 800;
}

.entry-title {
  font-weight: 800;
}

.entry-meta,
.hint {
  color: var(--muted);
  font-size: 13px;
}

.amount {
  font-weight: 900;
  text-align: right;
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.chip {
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--text);
  background: white;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

.chip.active {
  color: white;
  border: 0;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
}

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(92px + env(safe-area-inset-bottom));
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96);
  border-top: 1px solid #edf2f5;
  box-shadow: 0 -10px 30px rgba(15, 23, 42, .05);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 20;
}

.nav button {
  background: transparent;
  color: #6b7787;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  border-radius: 20px;
  font-size: 12px;
}

.nav button.active {
  color: var(--green-dark);
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  font-weight: 800;
}

.nav .nav-icon {
  font-size: 21px;
  line-height: 1;
}

.nav .add {
  transform: translateY(-22px);
  color: var(--green-dark);
  font-weight: 800;
}

.nav .add .nav-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-size: 34px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  box-shadow: 0 10px 22px rgba(31, 191, 112, .25);
  border: 6px solid white;
}

.dialog-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .22);
  display: grid;
  place-items: end center;
  padding: 18px;
  z-index: 40;
}

.dialog {
  width: min(460px, 100%);
  background: white;
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.dialog h3 {
  margin: 0 0 12px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 0;
}

.chart-wrap {
  display: grid;
  place-items: center;
}

.donut {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: conic-gradient(var(--green) var(--angle), #e8eef2 0);
  display: grid;
  place-items: center;
}

.donut::after {
  content: attr(data-label);
  width: 102px;
  height: 102px;
  border-radius: 50%;
  background: white;
  display: grid;
  place-items: center;
  text-align: center;
  white-space: pre-line;
  font-size: 13px;
  font-weight: 800;
}
