:root {
  color-scheme: light;
  --bg: #e8ebe4;
  --surface: #f8f9f5;
  --card: #ffffff;
  --ink: #11120f;
  --muted: #74776f;
  --line: #e4e6df;
  --lime: #d9ff43;
  --violet: #8f6af6;
  --coral: #ff756c;
  --mint: #59d3aa;
  --yellow: #ffc857;
  --radius: 20px;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

button, input, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.app-shell {
  position: relative;
  width: min(100%, 470px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 12px 18px 112px;
  overflow: hidden;
  background: var(--surface);
}

.status-bar, .app-header, .summary-topline, .summary-balance,
.capture-heading, .capture-actions, .section-heading, .profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-bar { height: 28px; padding: 0 4px; font-size: 11px; font-weight: 700; }
.status-icons { display: flex; align-items: center; gap: 5px; font-size: 8px; }

.app-header { padding: 16px 2px 20px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 500; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 25px; line-height: 1.25; }
h2 { margin-bottom: 0; font-size: 20px; line-height: 1.3; }

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
}
.icon-button svg { width: 20px; height: 20px; }
.icon-fallback { display: none; font-size: 20px; }
.glyph-icon { display: inline-grid; min-width: 1em; place-items: center; font-style: normal; font-weight: 700; line-height: 1; }

.search-panel {
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}
.search-panel:not([hidden]) { display: flex; }
.search-panel svg { width: 18px; color: var(--muted); }
.search-panel input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; }
.text-button { padding: 4px; border: 0; background: transparent; color: var(--ink); font-size: 13px; font-weight: 600; }

.summary-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 10px; }
.summary-grid.single-summary { grid-template-columns: 1fr; }
.summary-grid.single-summary .summary-main { grid-column: 1 / -1; }
.summary-card { min-height: 166px; padding: 16px; border-radius: var(--radius); overflow: hidden; }
.summary-main { background: var(--ink); color: white; }
.summary-topline { color: #d5d6d0; font-size: 11px; }
.summary-topline .trend { color: var(--lime); }
.summary-main > strong { display: block; margin: 24px 0 21px; font-size: 31px; line-height: 1; }
.summary-balance { justify-content: flex-start; gap: 19px; font-size: 12px; }
.summary-balance small { display: block; margin-bottom: 3px; color: #94978f; }
.countdown-card { display: flex; flex-direction: column; justify-content: space-between; background: var(--lime); }
.card-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: var(--ink); color: white; }
.card-icon svg { width: 17px; }
.countdown-card div { display: flex; align-items: baseline; gap: 5px; }
.countdown-card strong { font-size: 43px; line-height: 1; }
.countdown-card span, .countdown-card small { font-size: 12px; }

.capture-panel { margin: 14px 0 24px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.capture-heading { justify-content: flex-start; gap: 8px; }
.capture-heading h2 { font-size: 15px; }
.ai-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 4px #eee9ff; }
#captureForm textarea { width: 100%; min-height: 60px; margin: 14px 0 8px; padding: 0; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 20px; line-height: 1.5; }
#captureForm textarea::placeholder { color: #b2b4ad; }
.capture-actions > span { color: var(--muted); font-size: 11px; }
.capture-actions > div { display: flex; gap: 8px; }
.mic-button { width: 38px; height: 38px; background: #eef0ea; }
.mic-button.listening { background: var(--coral); color: white; animation: pulse 1.1s infinite; }
.submit-button { display: grid; width: 38px; height: 38px; place-items: center; border: 0; border-radius: 50%; background: var(--ink); color: white; }
.submit-button svg { width: 19px; }

.records-section { min-height: 300px; }
.section-heading { margin-bottom: 14px; }
.filters { display: flex; gap: 8px; margin-bottom: 16px; padding-bottom: 2px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--muted); font-size: 12px; }
.filter-chip.active { border-color: var(--ink); background: var(--ink); color: white; }
.records-list { display: grid; gap: 9px; }
.record-item { display: grid; grid-template-columns: 43px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); animation: rise .3s ease; }
.record-icon { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 13px; color: var(--ink); }
.record-icon svg, .record-icon .glyph-icon { width: 19px; }
.type-money .record-icon { background: #ffdedb; }
.type-note .record-icon { background: #d9f5eb; }
.type-countdown .record-icon { background: #edffac; }
.type-anniversary .record-icon { background: #e5dcff; }
.record-copy { min-width: 0; }
.record-copy strong, .record-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-copy strong { margin-bottom: 4px; font-size: 14px; }
.record-copy small { color: var(--muted); font-size: 11px; }
.record-value { max-width: 92px; text-align: right; }
.record-value strong { display: block; font-size: 14px; }
.record-value small { color: var(--muted); font-size: 10px; }
.empty-state { padding: 30px 10px; text-align: center; color: var(--muted); font-size: 13px; }

.view { animation: fade .25s ease; }
.view-title { padding: 14px 2px 24px; }
.view-title h2 { font-size: 28px; }
.category-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.category-card { min-height: 146px; padding: 16px; border: 0; border-radius: var(--radius); text-align: left; }
.category-card:nth-child(1) { background: var(--coral); }
.category-card:nth-child(2) { background: var(--mint); }
.category-card:nth-child(3) { background: var(--lime); }
.category-card:nth-child(4) { background: var(--violet); color: white; }
.category-card svg, .category-card .glyph-icon { width: 24px; font-size: 20px; }
.category-card strong { display: block; margin-top: 34px; font-size: 18px; }
.category-card small { font-size: 11px; opacity: .68; }

.stats-hero { padding: 20px; border-radius: var(--radius); background: var(--ink); color: white; }
.stats-hero > span { color: #a9aca3; font-size: 12px; }
.stats-hero > strong { display: block; margin: 5px 0 22px; font-size: 34px; }
.bar-chart { display: flex; height: 132px; align-items: flex-end; justify-content: space-between; gap: 14px; }
.bar-chart i { width: 100%; border-radius: 8px 8px 2px 2px; background: #4b4d47; }
.bar-chart i.current { background: var(--lime); }
.chart-labels { display: flex; justify-content: space-between; margin-top: 8px; color: #888b84; font-size: 9px; }
.stat-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat-pair article { padding: 18px; border-radius: var(--radius); }
.stat-pair article:first-child { background: var(--mint); }
.stat-pair article:last-child { background: var(--coral); }
.stat-pair span, .stat-pair small { display: block; font-size: 11px; }
.stat-pair strong { display: block; margin: 14px 0 4px; font-size: 21px; }

.profile-head { justify-content: flex-start; gap: 14px; padding: 24px 2px 28px; }
.profile-head h2 { font-size: 26px; }
.avatar { display: grid; width: 58px; height: 58px; place-items: center; border-radius: 50%; background: var(--lime); font-size: 20px; font-weight: 700; }
.settings-list { display: grid; gap: 8px; }
.settings-list button { display: flex; min-height: 58px; align-items: center; justify-content: space-between; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.settings-list button span { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.settings-list svg, .settings-list .glyph-icon { width: 18px; }
.settings-list small { color: var(--muted); }

.flow-view { padding: 12px 2px 24px; }
.back-button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 0; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
.back-button svg, .back-button .glyph-icon { width: 16px; }
.flow-title { padding: 30px 0 22px; }
.flow-title h2 { margin-bottom: 8px; font-size: 28px; }
.flow-title p:last-child { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.form-stack, .edit-fields { display: grid; gap: 12px; }
.form-stack label, .edit-fields label, .date-setting { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.form-stack input, .edit-fields input, .edit-fields select, .date-setting input, .search-field input { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: var(--card); color: var(--ink); }
.form-stack input:focus, .edit-fields input:focus, .edit-fields select:focus, .date-setting input:focus, .search-field input:focus { border-color: var(--ink); }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.code-row .text-button { min-width: 86px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.primary-button, .secondary-button, .danger-button { width: 100%; min-height: 46px; margin-top: 18px; border-radius: 13px; font-weight: 700; }
.primary-button { border: 0; background: var(--ink); color: white; }
.secondary-button { border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.danger-button { border: 0; background: var(--coral); color: var(--ink); }
.form-note, .result-count { color: var(--muted); font-size: 11px; text-align: center; }
.original-input { display: grid; gap: 7px; margin-bottom: 14px; padding: 15px; border-radius: 14px; background: #f0f1eb; }
.recognition-status { margin: -6px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.original-input span, .field-card span { color: var(--muted); font-size: 11px; }
.original-input strong { font-size: 15px; line-height: 1.45; }
.field-card, .reminder-card { display: flex; align-items: center; justify-content: space-between; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.field-card div, .reminder-card div { display: grid; gap: 5px; }
.field-card strong, .reminder-card strong { font-size: 15px; }
.field-card svg, .field-card .glyph-icon { width: 17px; color: var(--muted); }
.edit-fields { margin-top: 14px; }
.button-row { display: grid; gap: 2px; }
.search-field { display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.search-field svg, .search-field .glyph-icon { width: 18px; color: var(--muted); }
.search-field input { min-height: 44px; padding: 0; border: 0; }
.search-results { margin-top: 12px; }
.confirm-view { padding: 90px 18px 32px; text-align: center; }
.confirm-view h2 { margin: 20px 0 8px; font-size: 24px; }
.confirm-view p { margin: 0 auto; max-width: 270px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.confirm-icon { display: grid; width: 58px; height: 58px; margin: 0 auto; place-items: center; border-radius: 50%; background: #ffdedb; color: var(--coral); }
.confirm-icon svg, .confirm-icon .glyph-icon { width: 24px; }
.switch { position: relative; display: block; width: 46px; height: 28px; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: #d7dad2; }
.switch span::after { position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: white; content: ""; transition: transform .2s ease; }
.switch input:checked + span { background: var(--mint); }
.switch input:checked + span::after { transform: translateX(18px); }
.date-setting { margin-top: 14px; }

.bottom-nav { position: fixed; z-index: 10; bottom: 13px; left: 50%; display: grid; width: min(calc(100% - 28px), 438px); height: 72px; padding: 7px; grid-template-columns: repeat(4, 1fr); transform: translateX(-50%); border: 1px solid #2e302c; border-radius: 25px; background: rgba(17, 18, 15, .96); box-shadow: 0 12px 30px rgba(17,18,15,.22); }
.nav-item { display: flex; align-items: center; justify-content: center; gap: 5px; border: 0; border-radius: 19px; background: transparent; color: #8f9289; }
.nav-item svg { width: 18px; }
.nav-item > span:not(.glyph-icon) { display: none; font-size: 11px; font-weight: 600; }
.nav-item.active { background: var(--lime); color: var(--ink); }
.nav-item.active > span:not(.glyph-icon) { display: inline; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 98px; display: flex; width: min(calc(100% - 48px), 410px); align-items: center; justify-content: space-between; padding: 12px 14px; transform: translateX(-50%); border-radius: 12px; background: var(--ink); color: white; font-size: 13px; box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.toast button { border: 0; background: transparent; color: var(--lime); font-weight: 700; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pulse { 50% { transform: scale(.92); } }

@media (min-width: 560px) {
  body { padding: 28px 0; }
  .app-shell { min-height: calc(100vh - 56px); border: 1px solid #d5d8d0; border-radius: 34px; box-shadow: 0 30px 80px rgba(17,18,15,.16); }
  .bottom-nav { bottom: 41px; }
  .toast { bottom: 126px; }
}

@media (max-width: 360px) {
  .app-shell { padding-left: 13px; padding-right: 13px; }
  .summary-main > strong { font-size: 27px; }
  .summary-balance { gap: 10px; }
  .countdown-card strong { font-size: 37px; }
  .record-value { max-width: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; }
}
