:root {
  --bg-top: #f6eadb;
  --bg-bottom: #ead8c0;
  --surface: rgba(255, 249, 240, 0.88);
  --surface-strong: #fff9f1;
  --surface-soft: rgba(255, 245, 233, 0.84);
  --ink: #5d3922;
  --muted: #8c6245;
  --line: rgba(157, 101, 53, 0.16);
  --accent: #df8127;
  --accent-strong: #bf5f20;
  --accent-soft: rgba(223, 129, 39, 0.14);
  --warm-brown: #9c6641;
  --danger: #b35b33;
  --shadow-xl: 0 38px 120px rgba(103, 56, 25, 0.18);
  --shadow-lg: 0 22px 44px rgba(115, 67, 29, 0.14);
  --shadow-md: 0 14px 26px rgba(124, 77, 38, 0.11);
  --radius-xl: 36px;
  --radius-lg: 28px;
  --radius-md: 22px;
  --radius-sm: 16px;
  --font-sans: "Avenir Next", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 220, 165, 0.86), transparent 24%),
    radial-gradient(circle at 82% 9%, rgba(191, 95, 32, 0.16), transparent 18%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

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

button {
  border: 0;
  cursor: pointer;
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(24px);
}

.orb-one {
  top: -10rem;
  right: -8rem;
  width: 22rem;
  height: 22rem;
  background: rgba(231, 140, 44, 0.22);
}

.orb-two {
  left: -10rem;
  bottom: -12rem;
  width: 26rem;
  height: 26rem;
  background: rgba(157, 99, 57, 0.18);
}

.mesh {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.08;
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.device-shell {
  width: min(100%, 450px);
}

.device-frame {
  position: relative;
  padding: 14px;
  border-radius: 48px;
  background:
    linear-gradient(180deg, #2a1a12 0%, #140d09 100%);
  box-shadow: var(--shadow-xl);
}

.device-notch {
  position: absolute;
  top: 12px;
  left: 50%;
  width: 112px;
  height: 24px;
  transform: translateX(-50%);
  border-radius: 0 0 16px 16px;
  background: #160e0a;
  z-index: 2;
}

.app-surface {
  position: relative;
  overflow: hidden;
  border-radius: 36px;
  height: min(900px, calc(100vh - 56px));
  background:
    linear-gradient(180deg, rgba(255, 250, 244, 0.96) 0%, rgba(246, 236, 223, 0.96) 100%);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.app-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(230, 137, 45, 0.14), transparent 28%),
    radial-gradient(circle at left 60%, rgba(166, 103, 60, 0.08), transparent 25%);
  pointer-events: none;
}

.topbar,
.app-main,
.bottom-nav {
  position: relative;
  z-index: 1;
}

.topbar {
  padding: 20px 20px 12px;
}

.status-strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-top: 14px;
}

.eyebrow,
.section-kicker,
.draft-caption {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar h1,
.section-head h2 {
  margin: 4px 0 0;
  letter-spacing: -0.05em;
}

.topbar h1 {
  font-size: 2rem;
}

.topbar-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
  max-width: 16rem;
}

.topbar-actions {
  display: grid;
  gap: 10px;
}

.ghost-button,
.primary-button,
.submit-button,
.quick-chip,
.delete-button {
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.ghost-button {
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(255, 247, 236, 0.78);
  color: var(--ink);
  border: 1px solid rgba(196, 129, 73, 0.18);
  box-shadow: 0 6px 14px rgba(146, 91, 49, 0.08);
}

.ghost-button:hover,
.quick-chip:hover,
.delete-button:hover {
  transform: translateY(-1px);
}

.ghost-danger {
  color: var(--danger);
}

.app-main {
  overflow-y: auto;
  padding: 8px 18px 14px;
  scrollbar-width: none;
}

.app-main::-webkit-scrollbar {
  display: none;
}

.view {
  display: none;
  gap: 14px;
  padding-bottom: 18px;
  animation: rise 260ms ease;
}

.view.is-active {
  display: grid;
}

.summary-card,
.insight-card,
.section-card,
.draft-preview-card,
.review-card,
.expense-item,
.archive-item,
.empty-state,
.review-note,
.category-bar {
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.summary-card,
.insight-card,
.section-card {
  border-radius: var(--radius-xl);
}

.summary-card {
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(255, 240, 219, 0.94), rgba(255, 248, 239, 0.88)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent);
}

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

.summary-label,
.summary-copy,
.metric-card span,
.insight-label,
.insight-tip,
.section-note,
.field span,
.month-picker span,
.review-card span,
.review-card p,
.archive-meta,
.expense-meta,
.expense-note,
.review-muted {
  color: var(--muted);
}

.summary-label {
  margin: 0;
  font-size: 0.92rem;
}

.summary-amount {
  display: block;
  margin-top: 10px;
  font-size: 2.5rem;
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.summary-copy {
  margin: 12px 0 0;
  line-height: 1.6;
}

.primary-button,
.submit-button {
  border-radius: 999px;
  color: #fffaf4;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 14px 24px rgba(191, 95, 32, 0.22);
}

.primary-button {
  padding: 14px 18px;
  min-width: 108px;
  font-weight: 700;
}

.primary-button:hover,
.submit-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 28px rgba(191, 95, 32, 0.28);
}

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

.metric-card {
  padding: 15px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 251, 246, 0.74);
  border: 1px solid var(--line);
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.02rem;
  letter-spacing: -0.03em;
}

.insight-card {
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(255, 243, 226, 0.95), rgba(255, 249, 241, 0.9)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent);
}

.insight-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.insight-title {
  display: block;
  margin-top: 14px;
  font-size: 1.18rem;
}

.insight-body,
.draft-reason,
.draft-tip,
.review-note {
  line-height: 1.64;
}

.insight-body {
  margin: 12px 0 0;
}

.insight-tip {
  margin: 12px 0 0;
  font-size: 0.94rem;
}

.section-card {
  padding: 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 1.22rem;
}

.section-note {
  max-width: 11rem;
  text-align: right;
  line-height: 1.55;
  font-size: 0.92rem;
}

.compact-head {
  margin-bottom: 14px;
}

.expense-list,
.review-notes,
.category-breakdown,
.category-bars {
  display: grid;
  gap: 12px;
}

.expense-item {
  padding: 16px;
  border-radius: var(--radius-md);
  display: grid;
  gap: 12px;
  background: rgba(255, 251, 245, 0.9);
}

.expense-item-head,
.expense-item-foot,
.archive-item-head,
.category-bar-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.expense-item-head strong {
  display: block;
  font-size: 1.05rem;
}

.expense-amount {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.expense-meta,
.archive-meta,
.review-muted {
  font-size: 0.9rem;
}

.expense-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag,
.decision-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
}

.tag {
  background: rgba(249, 237, 221, 0.92);
  border: 1px solid rgba(197, 132, 76, 0.18);
}

.decision-chip {
  font-weight: 700;
  background: rgba(160, 113, 56, 0.14);
  color: #7a552f;
}

.expense-note {
  margin: 0;
}

.item-category {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.item-category span {
  white-space: nowrap;
  color: var(--muted);
}

.item-category-select,
.month-picker select,
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid rgba(171, 110, 59, 0.18);
  background: rgba(255, 252, 248, 0.92);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.item-category-select:focus,
.month-picker select:focus {
  border-color: rgba(223, 129, 39, 0.62);
  box-shadow: 0 0 0 4px rgba(223, 129, 39, 0.14);
  transform: translateY(-1px);
}

.delete-button {
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(255, 244, 236, 0.98);
  color: var(--accent-strong);
  font-weight: 700;
}

.add-view-card {
  gap: 16px;
}

.quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 246, 235, 0.92);
  color: var(--ink);
  border: 1px solid rgba(201, 135, 79, 0.16);
}

.draft-preview-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 243, 227, 0.94), rgba(255, 249, 241, 0.88)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent);
}

.draft-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.draft-preview-head strong {
  display: block;
  margin-top: 6px;
  font-size: 1.1rem;
}

.draft-amount {
  display: block;
  margin-top: 14px;
  font-size: 2rem;
  letter-spacing: -0.05em;
}

.draft-reason,
.draft-tip {
  margin: 12px 0 0;
}

.expense-form {
  display: grid;
  gap: 14px;
}

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

.field span {
  font-size: 0.92rem;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field textarea {
  resize: vertical;
  min-height: 100px;
}

.submit-button {
  padding: 16px 18px;
  font-weight: 700;
}

.month-picker {
  display: grid;
  gap: 8px;
  min-width: 134px;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.review-card {
  padding: 18px;
  border-radius: var(--radius-lg);
}

.review-card strong {
  display: block;
  margin-top: 12px;
  font-size: 1.12rem;
}

.review-card p {
  margin: 10px 0 0;
}

.category-bar {
  padding: 14px;
  border-radius: var(--radius-md);
}

.bar-track {
  position: relative;
  margin-top: 10px;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(219, 193, 162, 0.46);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
}

.review-note,
.archive-item,
.empty-state {
  padding: 16px;
  border-radius: var(--radius-md);
}

.archive-item {
  display: grid;
  gap: 10px;
}

.archive-highlight {
  font-weight: 700;
  font-size: 1.08rem;
}

.empty-state {
  text-align: center;
  line-height: 1.7;
  color: var(--muted);
}

.empty-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.secondary-button {
  padding: 13px 16px;
  border-radius: 999px;
  background: rgba(255, 246, 236, 0.95);
  color: var(--accent-strong);
  border: 1px solid rgba(197, 132, 76, 0.18);
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 249, 241, 0.9);
  border-top: 1px solid rgba(175, 116, 66, 0.12);
  backdrop-filter: blur(14px);
}

.nav-button {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.nav-button.is-active {
  color: var(--accent-strong);
  background: rgba(255, 239, 217, 0.92);
  box-shadow: inset 0 0 0 1px rgba(212, 136, 66, 0.12);
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.status-high {
  background: rgba(226, 104, 46, 0.16);
  color: #a74d1d;
}

.status-medium {
  background: rgba(235, 160, 66, 0.16);
  color: #a96a1d;
}

.status-low {
  background: rgba(160, 113, 56, 0.14);
  color: #7a552f;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .stage {
    padding: 0;
  }

  .device-shell {
    width: 100%;
  }

  .device-frame {
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .device-notch {
    display: none;
  }

  .app-surface {
    height: 100vh;
    border-radius: 0;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding-inline: 16px;
  }

  .topbar-main,
  .summary-head,
  .insight-head,
  .section-head,
  .expense-item-head,
  .expense-item-foot,
  .archive-item-head,
  .category-bar-head {
    display: grid;
  }

  .section-note {
    text-align: left;
    max-width: none;
  }

  .metric-grid,
  .review-grid,
  .field-row {
    grid-template-columns: 1fr;
  }

  .item-category {
    display: grid;
  }
}
