:root {
  color-scheme: light;
  --blue: #0ea5ff;
  --blue-2: #25c7f5;
  --deep-blue: #2563eb;
  --violet: #7c5cff;
  --violet-2: #a78bfa;
  --red: #ff4d5e;
  --green: #14b86a;
  --yellow: #ffca5f;
  --ink: #1f2937;
  --muted: #7c8799;
  --line: rgba(95, 119, 161, 0.16);
  --card: rgba(255, 255, 255, 0.82);
  --card-strong: rgba(255, 255, 255, 0.94);
  --bg: #f5f9ff;
  --shadow: 0 16px 42px rgba(37, 99, 235, 0.14);
  --soft-shadow: 0 10px 28px rgba(31, 41, 55, 0.08);
  --radius: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 20% 0%, rgba(124, 92, 255, 0.18), transparent 32%),
    linear-gradient(180deg, #eaf8ff 0%, #f6f5ff 45%, #ffffff 100%);
}

.phone-app {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(86px + env(safe-area-inset-bottom));
}

.page {
  display: none;
  min-height: calc(100vh - 86px);
}

.page.active {
  display: block;
}

.hero {
  position: relative;
  padding: calc(18px + env(safe-area-inset-top)) 18px 30px;
  overflow: hidden;
  color: white;
  background:
    linear-gradient(125deg, rgba(14, 165, 255, 0.98), rgba(37, 199, 245, 0.96) 50%, rgba(124, 92, 255, 0.95));
  border-bottom-left-radius: 34px;
  border-bottom-right-radius: 34px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -18% -44% 16%;
  height: 190px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  filter: blur(4px);
}

.hero-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero h1 {
  margin: 18px 0 6px;
  font-size: 34px;
  letter-spacing: 0;
}

.hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
}

.chip,
.glass,
.card,
.sheet {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.rate-card {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 20px;
  color: white;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.42);
}

.rate-card strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.rate-card span {
  display: block;
  font-size: 16px;
  font-weight: 760;
  white-space: nowrap;
}

.icon-btn,
.round-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: white;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.icon-btn.dark {
  color: var(--deep-blue);
  background: rgba(255, 255, 255, 0.9);
}

.content {
  padding: 16px;
}

.content.pull {
  margin-top: -22px;
  position: relative;
  z-index: 2;
}

.card {
  border-radius: var(--radius);
  padding: 16px;
  color: var(--ink);
}

.card + .card,
.section + .section {
  margin-top: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 2px 10px;
  color: var(--ink);
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.tabs,
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(224, 239, 255, 0.76);
}

.tabs button,
.segmented button,
.pill {
  min-height: 40px;
  border-radius: 14px;
  color: #516078;
  background: transparent;
  font-weight: 700;
}

.tabs button.active,
.segmented button.active,
.pill.active {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
}

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

.metric {
  padding: 14px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  letter-spacing: 0;
}

.metric.expense strong,
.amount.expense {
  color: var(--red);
}

.metric.income strong,
.amount.income {
  color: var(--green);
}

.sparkline {
  width: 100%;
  height: 62px;
  margin: 14px 0 2px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.quick-card {
  min-height: 78px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.8);
  color: #536079;
  box-shadow: var(--soft-shadow);
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 10px 6px;
  text-align: center;
  font-size: 13px;
}

.quick-card .emoji,
.category-dot,
.pay-dot {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(14, 165, 255, 0.18), rgba(124, 92, 255, 0.18));
  font-size: 22px;
}

.list-card {
  overflow: hidden;
  padding: 0;
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  color: #5c6980;
  background: rgba(255, 255, 255, 0.48);
  border-bottom: 1px solid var(--line);
}

.record-row {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.record-row:last-child {
  border-bottom: 0;
}

.record-title {
  font-weight: 760;
  margin-bottom: 3px;
}

.record-sub,
.small {
  color: var(--muted);
  font-size: 13px;
}

.amount {
  font-size: 17px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.converted {
  margin-top: 3px;
  color: #728096;
  font-size: 12px;
  text-align: right;
}

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.32);
  font-weight: 800;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.88);
  border-top: 1px solid rgba(120, 144, 178, 0.16);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.nav-btn {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 58px;
  color: #637083;
  background: transparent;
  font-size: 12px;
}

.nav-btn .nav-icon {
  font-size: 23px;
}

.nav-btn.active {
  color: var(--deep-blue);
  font-weight: 800;
}

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

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

.field label {
  color: #566277;
  font-size: 13px;
  font-weight: 700;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(125, 145, 176, 0.18);
  border-radius: 16px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
}

.textarea {
  min-height: 78px;
  padding: 12px 14px;
  resize: vertical;
}

.amount-input {
  width: 100%;
  border: 0;
  border-radius: 24px;
  padding: 18px;
  font-size: 36px;
  font-weight: 850;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  outline: none;
  text-align: center;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.category-option {
  min-height: 86px;
  padding: 10px 6px;
  border-radius: 20px;
  color: #4b5567;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--soft-shadow);
  display: grid;
  place-items: center;
  gap: 6px;
  text-align: center;
  font-size: 13px;
}

.category-option.active {
  color: var(--deep-blue);
  outline: 2px solid rgba(14, 165, 255, 0.74);
  background: rgba(226, 244, 255, 0.9);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 0 14px;
  border: 1px solid rgba(125, 145, 176, 0.18);
  background: rgba(255, 255, 255, 0.78);
}

.primary,
.secondary,
.danger,
.ghost {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 16px;
  font-weight: 800;
}

.primary {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
}

.secondary {
  color: var(--deep-blue);
  background: rgba(230, 242, 255, 0.92);
}

.danger {
  color: white;
  background: linear-gradient(135deg, #ff4d5e, #ff8a7a);
}

.ghost {
  color: #5d697c;
  background: rgba(255, 255, 255, 0.68);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.donut-wrap {
  display: grid;
  place-items: center;
  padding: 16px 0 8px;
}

.donut {
  position: relative;
  width: min(72vw, 280px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--red) 0 40%, var(--blue) 40% 62%, #20c997 62% 78%, var(--violet) 78% 92%, var(--yellow) 92% 100%);
  box-shadow: 0 18px 44px rgba(37, 99, 235, 0.18);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 0 0 1px rgba(125, 145, 176, 0.12);
}

.donut-center {
  position: absolute;
  inset: 28%;
  z-index: 1;
  display: grid;
  place-items: center;
  text-align: center;
}

.donut-center span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.donut-center strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.rank-row,
.settings-row,
.manage-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
}

.rank-row:last-child,
.settings-row:last-child,
.manage-row:last-child {
  border-bottom: 0;
}

.status {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status.on {
  color: #0e9f61;
  background: rgba(20, 184, 106, 0.12);
}

.status.off {
  color: #d14b5b;
  background: rgba(255, 77, 94, 0.12);
}

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

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(94px + env(safe-area-inset-bottom));
  z-index: 40;
  display: none;
  padding: 14px 16px;
  border-radius: 18px;
  color: white;
  background: rgba(31, 41, 55, 0.9);
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  padding: 18px;
  align-items: flex-end;
  background: rgba(12, 24, 42, 0.42);
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  width: 100%;
  max-height: 86vh;
  overflow: auto;
  padding: 18px;
  border-radius: 28px 28px 20px 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -20px 54px rgba(31, 41, 55, 0.24);
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 22px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.privacy-note {
  padding: 12px;
  border-radius: 16px;
  color: #2f5d76;
  background: rgba(37, 199, 245, 0.12);
  line-height: 1.55;
  font-size: 13px;
}

.lock-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: linear-gradient(135deg, #0ea5ff, #25c7f5 45%, #7c5cff);
  color: white;
}

.lock-card {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 54px rgba(31, 41, 55, 0.2);
}

.lock-card h1 {
  margin: 0 0 8px;
  font-size: 32px;
}

.lock-card p {
  color: rgba(255, 255, 255, 0.84);
}

.lock-card .input {
  color: var(--ink);
  margin: 10px 0;
}

.file-input {
  width: 100%;
}

.plus-mark {
  font-size: 26px;
}

.full-width {
  width: 100%;
}

.mini-delete {
  min-height: 32px;
  padding: 0 10px;
  margin-top: 6px;
}

.mt-0 {
  margin-top: 0;
}

.mt-10 {
  margin-top: 10px;
}

.mt-12 {
  margin-top: 12px;
}

.compact-row {
  grid-template-columns: 28px 1fr;
}

.action-stack {
  display: grid;
  gap: 6px;
}

@media (min-width: 720px) {
  .phone-app {
    max-width: 460px;
    margin: 0 auto;
    box-shadow: 0 0 0 1px rgba(120, 144, 178, 0.12);
    background: var(--bg);
  }

  .bottom-nav {
    max-width: 460px;
    margin: 0 auto;
  }
}
