:root {
  color-scheme: light;
  --paper: #f7f7f0;
  --card: #fffef9;
  --ink: #25372f;
  --muted: #80877d;
  --green: #286047;
  --green-dark: #204d39;
  --line: #e6e9df;
  --soft-green: #edf2e8;
  --error: #a44035;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button { cursor: pointer; }
button, a, input { touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 3px solid #93b39d; outline-offset: 4px; }
input:focus-visible { outline: none; }
[hidden] { display: none !important; }

.page { width: min(100% - 40px, 680px); margin: 0 auto; padding: 35px 0 28px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 650; letter-spacing: .04em; }
.brand-mark { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 10px; background: var(--green); color: #fffef9; font-size: 17px; font-weight: 500; }
.current-date { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .02em; }
.intro { padding: 42px 0 24px; }
.eyebrow { margin: 0 0 10px; color: #74816e; font-size: 13px; letter-spacing: .04em; }
.intro-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
h1 { margin: 0; font-size: clamp(25px, 4.8vw, 32px); font-weight: 650; letter-spacing: -.035em; line-height: 1.4; }
.daily-total { text-align: right; flex-shrink: 0; }
.daily-total > span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.daily-total strong { display: block; color: var(--green); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.entry-card { background: var(--card); border: 1px solid var(--line); border-radius: 23px; padding: 26px; box-shadow: 0 9px 30px #364b3210; }
.category-field { margin: 0; padding: 0; border: 0; min-width: 0; }
legend, .field > label { margin: 0; padding: 0; display: block; color: #566252; font-size: 13px; font-weight: 550; }
.category-options { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; margin-top: 12px; }
.category-option { position: relative; }
.category-option input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.category-option span { display: grid; place-items: center; height: 48px; border: 1px solid var(--line); border-radius: 12px; color: #75816f; background: #fcfcf7; font-size: 18px; transition: background .15s, color .15s, border-color .15s; cursor: pointer; }
.category-option input:checked + span { color: var(--green); border-color: #87a990; background: var(--soft-green); font-weight: 650; }
.category-option input:focus-visible + span { outline: 3px solid #93b39d; outline-offset: 3px; }
.field { margin-top: 25px; }
.amount-control { display: flex; align-items: center; gap: 13px; min-height: 66px; margin-top: 8px; border-bottom: 1px solid var(--line); transition: border-color .15s; }
.amount-control:focus-within { border-color: var(--green); }
.amount-control > span { color: #83907a; font-size: 26px; }
.amount-control input { min-width: 0; width: 100%; border: 0; padding: 5px 0 8px; color: var(--ink); background: transparent; font-size: 38px; line-height: 1.3; font-weight: 500; letter-spacing: -.04em; font-variant-numeric: tabular-nums; border-radius: 0; }
.amount-control input::placeholder { color: #ced3c7; opacity: 1; }
.amount-control:has(input[aria-invalid="true"]) { border-color: var(--error); }
.time-field { margin-top: 22px; }
.time-field input { display: block; width: 100%; min-width: 0; height: 48px; padding: 0 13px; margin-top: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fcfcf7; color: #4b5b45; font-size: 15px; -webkit-appearance: none; appearance: none; }
.time-field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px #28604713; }
.time-field input[aria-invalid="true"] { border-color: var(--error); }
.field-error { margin: 7px 0 0; color: var(--error); font-size: 12px; line-height: 1.6; }
.save-button { display: block; width: 100%; min-height: 49px; margin-top: 26px; border: 0; border-radius: 12px; background: var(--green); color: #fffef9; font-size: 15px; font-weight: 600; letter-spacing: .07em; transition: background .15s, transform .15s; }
.save-button > span { font-size: 20px; font-weight: 400; vertical-align: -1px; margin-right: 3px; }
.save-button:hover { background: var(--green-dark); }
.save-button:active { transform: translateY(1px); }
.form-status { margin: 12px 0 0; color: var(--green); font-size: 12px; text-align: center; line-height: 1.7; }
.form-status.is-error { color: var(--error); }
.records-section { margin-top: 32px; }
.records-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: .025em; }
h2 span { margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.record-filters { display: flex; padding: 3px; gap: 2px; background: #eaeede; border-radius: 10px; }
.record-filters button { padding: 7px 13px; min-height: 32px; background: transparent; color: #7f8976; border: 0; border-radius: 7px; font-size: 12px; line-height: 1.3; }
.record-filters button[aria-pressed="true"] { color: var(--green); background: var(--card); box-shadow: 0 1px 4px #344b3310; font-weight: 600; }
.storage-status { color: var(--error); font-size: 12px; line-height: 1.7; margin: 14px 0; }
.day-group { margin-top: 22px; }
.day-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 11px; color: var(--muted); font-size: 12px; }
.day-heading h3 { margin: 0; font-size: 12px; font-weight: 500; }
.day-heading span { font-variant-numeric: tabular-nums; }
.record-items { padding: 0; margin: 0; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 17px; overflow: hidden; }
.record-item { display: flex; align-items: center; gap: 12px; min-height: 75px; padding: 14px 15px 14px 17px; }
.record-item + .record-item { border-top: 1px solid var(--line); }
.record-category { display: grid; place-items: center; flex-shrink: 0; width: 39px; height: 39px; border-radius: 12px; background: var(--soft-green); color: var(--green); font-size: 17px; }
.record-detail { flex: 1; min-width: 0; }
.record-detail strong { display: block; font-size: 13px; font-weight: 550; }
.record-detail time { display: block; margin-top: 5px; color: #939b8e; font-size: 11px; font-variant-numeric: tabular-nums; }
.record-amount { margin-left: 4px; color: var(--ink); font-size: 17px; font-weight: 550; letter-spacing: -.015em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delete-button { display: grid; place-items: center; width: 34px; height: 36px; flex-shrink: 0; margin-left: 0; padding: 0; color: #adb5a5; background: transparent; border: 0; border-radius: 8px; }
.delete-button:hover { color: var(--error); background: #a4403509; }
.delete-button svg { width: 15px; height: 15px; }
.empty-state { text-align: center; padding: 32px 12px 22px; }
.empty-mark { display: grid; place-items: center; width: 45px; height: 45px; margin: 0 auto 12px; border: 1px dashed #cdd6c3; border-radius: 15px; color: #a4b59a; font-size: 22px; font-weight: 300; }
.empty-state p { margin: 0 0 5px; color: #7a8470; font-size: 13px; }
.empty-state > span:last-child { color: #a3aa9c; font-size: 11px; }
.page-footer { margin-top: 28px; text-align: center; color: #9ba392; font-size: 11px; line-height: 1.8; }
.undo-toast { position: fixed; bottom: max(22px, env(safe-area-inset-bottom)); left: 50%; display: flex; align-items: center; justify-content: space-between; gap: 24px; transform: translateX(-50%); padding: 12px 14px 12px 18px; border-radius: 13px; background: #25372f; color: var(--card); box-shadow: 0 5px 25px #25372f25; font-size: 13px; white-space: nowrap; z-index: 10; }
.undo-toast button { min-height: 32px; padding: 3px 10px; border: 0; border-radius: 7px; color: #d8ead0; background: #ffffff12; font-size: 13px; }

@media (max-width: 480px) {
  .page { width: calc(100% - 36px); padding-top: 22px; }
  .intro { padding-top: 35px; padding-bottom: 21px; }
  .intro-row { align-items: flex-end; gap: 10px; }
  .daily-total strong { font-size: 21px; }
  .entry-card { padding: 21px 19px; border-radius: 21px; }
  .category-options { gap: 7px; }
  .category-option span { height: 44px; border-radius: 10px; font-size: 17px; }
  .field { margin-top: 23px; }
  .time-field { margin-top: 21px; }
  .records-section { margin-top: 28px; }
  .record-item { padding-left: 13px; padding-right: 10px; gap: 9px; }
  .record-amount { font-size: 16px; }
}

@media (max-width: 360px) {
  .page { width: calc(100% - 28px); }
  h1 { font-size: 23px; }
  .daily-total strong { font-size: 18px; }
  .entry-card { padding: 20px 16px; }
  .category-options { gap: 5px; }
  .record-amount { font-size: 15px; }
  .record-category { width: 34px; height: 36px; }
  .delete-button { width: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
