:root {
  --page: #e8e9e6;
  --dark: #151713;
  --dark-soft: #20231d;
  --input: #262a23;
  --paper: #f6f7f1;
  --paper-soft: #e9ece3;
  --ink: #20241e;
  --ink-on-dark: #f4f5ed;
  --muted: #899083;
  --muted-dark: #92988d;
  --line-dark: #3c4336;
  --line-light: #e2e5dd;
  --lime: #b9ff52;
  --lime-hover: #d4ff7e;
  --money: #83d9c3;
  --money-ink: #147c67;
  --note: #ff9786;
  --note-ink: #c95845;
  --countdown: #b6a8ff;
  --countdown-ink: #6f59d2;
  --anniversary: #ffd36a;
  --anniversary-ink: #a66f00;
  --danger: #db704e;
  --danger-soft: #ffe5db;
  --mono: "DM Mono", Consolas, "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: Manrope, "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, textarea, input, select { font: inherit; }
button { border: 0; cursor: pointer; }
button:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 0 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 5px rgba(185, 255, 82, 0.18);
}

.brand strong { display: block; font-size: 19px; font-weight: 800; line-height: 1; }
.brand small { display: block; margin-top: 5px; color: #777d72; font: 9px var(--mono); }
.topbar-actions { display: flex; align-items: center; gap: 9px; }

.icon-button, .profile-button {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  padding: 0;
  border-radius: 50%;
  background: #daddd6;
  color: #3b4038;
  font-size: 21px;
}

.profile-button { background: var(--dark); color: var(--lime); font-size: 12px; font-weight: 800; }
.page-stack { display: flex; flex-direction: column; gap: 14px; }
.dark-card, .light-card { border-radius: 22px; overflow: hidden; }

.dark-card {
  background: var(--dark);
  color: var(--ink-on-dark);
  box-shadow: 0 15px 35px rgba(24, 29, 20, 0.14);
}

.light-card {
  padding: 23px;
  background: var(--paper);
  box-shadow: 0 9px 22px rgba(34, 39, 31, 0.07);
}

.capture-card { padding: 23px 20px 18px; }
.capture-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.eyebrow { margin: 0; color: var(--muted); font: 10px var(--mono); text-transform: uppercase; }
.live-dot { display: inline-block; width: 6px; height: 6px; margin-left: 3px; border-radius: 50%; background: var(--lime); vertical-align: 1px; }

.capture-card h1 {
  max-width: 300px;
  margin: 13px 0 24px;
  color: var(--ink-on-dark);
  font-size: 25px;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: 0;
}

.date-badge { flex: 0 0 auto; padding-top: 2px; color: var(--muted-dark); font: 9px var(--mono); }
.input-shell { padding: 16px 16px 12px; border: 1px solid var(--line-dark); border-radius: 16px; background: var(--input); transition: border-color 160ms ease; }
.input-shell:focus-within { border-color: var(--lime); }

.input-shell textarea {
  display: block;
  width: 100%;
  min-height: 86px;
  padding: 0;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f5f7ef;
  font-size: 16px;
  line-height: 1.5;
}

.input-shell textarea::placeholder { color: #777e70; opacity: 1; }
.input-actions { display: flex; align-items: center; gap: 10px; margin-top: 11px; }
.voice-button { position: relative; width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; background: #353b30; }

.voice-icon {
  position: absolute;
  top: 7px;
  left: 11px;
  width: 8px;
  height: 11px;
  border: 2px solid var(--lime);
  border-radius: 5px;
}

.voice-icon::after {
  content: "";
  position: absolute;
  left: -5px;
  bottom: -5px;
  width: 14px;
  height: 7px;
  border: 2px solid var(--lime);
  border-top: 0;
  border-radius: 0 0 9px 9px;
}

.voice-button.is-listening { animation: voicePulse 1s ease-in-out infinite; }
.input-hint { margin-right: auto; color: #777e70; font: 9px var(--mono); }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 39px; padding: 10px 15px; border-radius: 10px; background: var(--lime); color: #17200f; font-size: 11px; font-weight: 800; }
.primary-button:hover { background: var(--lime-hover); }
.primary-button:disabled { opacity: 0.55; cursor: wait; }
.organize-button { min-width: 82px; }

.capture-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: #777e70; font-size: 9px; }
.privacy-label { white-space: nowrap; font-family: var(--mono); }
.privacy-label i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--lime); }

.overview-card, .week-card { padding: 24px; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #c5c9bf; font: 10px var(--mono); text-transform: uppercase; }
.card-topline h2 { margin: 0; color: inherit; font: inherit; }
.card-topline time { color: #777d72; }
.record-total { display: flex; align-items: baseline; gap: 9px; margin-top: 32px; }
.record-total strong { font-size: 62px; font-weight: 700; line-height: 0.95; }
.record-total span { color: #8e9387; font-size: 12px; }
.muted-copy { margin: 8px 0 0; color: #a2a89b; font-size: 12px; }

.mini-stats { display: grid; gap: 12px; margin: 28px 0 0; padding-top: 15px; border-top: 1px solid #34392f; }
.mini-stats div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mini-stats dt { color: #92998b; font-size: 11px; }
.mini-stats dd { margin: 0; color: #eff1e8; font: 500 12px var(--mono); }
.lime-text { color: var(--lime) !important; }

.outline-button { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 26px; padding: 12px 13px; border: 1px solid #444a3f; border-radius: 12px; background: transparent; color: #f0f2e9; font-size: 11px; }
.outline-button:hover { border-color: var(--lime); color: var(--lime); }
.chart { height: 112px; margin-top: 27px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart-grid { fill: none; stroke: #31372d; stroke-width: 1; stroke-dasharray: 2 4; }
#trendLine { fill: none; stroke: var(--lime); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.trend-dot { fill: var(--lime); stroke: var(--dark); stroke-width: 3; }
.chart-labels { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 8px; color: #6f766a; font: 9px var(--mono); text-align: center; }
.trend-note { margin: 24px 0 0; color: #c2c8ba; font-size: 11px; }
.trend-note i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--lime); }

.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.section-head h2 { margin: 8px 0 0; font-size: 17px; line-height: 1.25; }
.text-button, .close-button { padding: 0; background: transparent; color: #777e72; font-size: 10px; }
.close-button { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; background: var(--paper-soft); font-size: 19px; line-height: 1; }
.category-list { display: grid; gap: 8px; margin-top: 18px; }

.category-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 7px 8px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.category-item:hover, .category-item.is-active { background: #e6eae1; }
.category-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; font-size: 13px; font-weight: 800; }
.category-all { background: #dce3d8; color: #4f5c4b; }
.category-money, .type-money { background: rgba(131, 217, 195, 0.35); color: var(--money-ink); }
.category-note, .type-note { background: rgba(255, 151, 134, 0.3); color: var(--note-ink); }
.category-countdown, .type-countdown { background: rgba(182, 168, 255, 0.32); color: var(--countdown-ink); }
.category-anniversary, .type-anniversary { background: rgba(255, 211, 106, 0.4); color: var(--anniversary-ink); }
.category-copy { min-width: 0; }
.category-copy strong, .category-copy small { display: block; }
.category-copy strong { font-size: 11px; }
.category-copy small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.category-item b { color: #858c80; font: 500 11px var(--mono); }

.status-chip { display: inline-block; margin-left: 5px; padding: 3px 6px; border-radius: 8px; background: var(--paper-soft); color: #777d72; font-size: 8px; vertical-align: 1px; }
.status-chip.is-pending { background: var(--danger-soft); color: var(--danger); }
.empty-state { display: grid; justify-items: center; padding: 34px 18px 25px; text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 12px; border-radius: 50%; background: var(--paper-soft); color: #899083; font-size: 16px; }
.empty-state strong { font-size: 12px; }
.empty-state p { max-width: 240px; margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.empty-state.compact { padding-bottom: 14px; }
.review-list { display: grid; gap: 9px; margin-top: 19px; }

.review-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) 28px; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line-light); border-radius: 13px; }
.review-item.has-missing { border-color: rgba(219, 112, 78, 0.55); background: #fffaf7; }
.review-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 10px; font-size: 13px; font-weight: 800; }
.review-copy { min-width: 0; }
.review-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; color: #6f766b; font-size: 9px; }
.review-meta time { color: #a5aa9f; }
.review-copy strong { display: block; overflow-wrap: anywhere; font-size: 12px; line-height: 1.4; }
.review-copy small { display: block; margin-top: 5px; color: var(--muted); font: 9px/1.45 var(--mono); overflow-wrap: anywhere; }
.review-copy input { width: 100%; padding: 8px 9px; border: 1px solid #ccd1c7; border-radius: 8px; background: #fff; color: var(--ink); font-size: 12px; }
.draft-editor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.draft-field { display: grid; align-content: start; gap: 5px; min-width: 0; }
.draft-field-wide { grid-column: 1 / -1; }
.draft-field span { color: #72796d; font: 9px var(--mono); }
.draft-field input, .draft-field select, .draft-field textarea { width: 100%; min-width: 0; padding: 8px 9px; border: 1px solid #ccd1c7; border-radius: 8px; background: #fff; color: var(--ink); font-size: 12px; }
.draft-field textarea { min-height: 72px; resize: vertical; line-height: 1.45; }
.confirm-item { display: grid; place-items: center; width: 27px; height: 27px; padding: 0; border-radius: 50%; background: #e8ebe5; color: #778071; font-size: 13px; }
.confirm-item:hover { background: var(--lime); color: #17200f; }
.review-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.secondary-button { min-height: 39px; padding: 10px 15px; border-radius: 10px; background: var(--paper-soft); color: #646b60; font-size: 11px; }

.filter-label { padding: 5px 8px; border-radius: 8px; background: var(--paper-soft); color: #777d72; font: 9px var(--mono); }
.recent-list { display: grid; gap: 18px; margin-top: 20px; }
.recent-item { display: grid; grid-template-columns: 11px minmax(0, 1fr); gap: 11px; align-items: start; }
.timeline-dot { width: 10px; height: 10px; margin-top: 3px; border-radius: 50%; }
.timeline-dot.type-money { background: #55c6a9; }
.timeline-dot.type-note { background: #fa8774; }
.timeline-dot.type-countdown { background: #8d79ed; }
.timeline-dot.type-anniversary { background: #edbe4f; }
.recent-copy { min-width: 0; }
.recent-copy strong, .recent-copy small { display: block; }
.recent-copy strong { overflow-wrap: anywhere; font-size: 11px; line-height: 1.45; }
.recent-copy small { margin-top: 4px; color: var(--muted); font: 9px var(--mono); }

.footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 21px; padding: 0 2px; color: #8b9185; font: 8px var(--mono); }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 26px; width: max-content; max-width: calc(100vw - 28px); padding: 11px 16px; border-radius: 10px; background: var(--dark); color: #f2f5eb; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); font-size: 11px; opacity: 0; pointer-events: none; transform: translate(-50%, 18px); transition: opacity 180ms ease, transform 180ms ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }


@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 255, 82, 0.1); }
  50% { box-shadow: 0 0 0 7px rgba(185, 255, 82, 0.18); }
}

@media (min-width: 520px) {
  .app-shell { padding-top: 28px; padding-bottom: 34px; }
}

@media (max-width: 390px) {
  .draft-editor { grid-template-columns: 1fr; }
  .draft-field-wide { grid-column: auto; }
}

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