:root {
  color-scheme: light;
  --page: #f2f5f1;
  --surface: #fff;
  --ink: #162822;
  --muted: #4d635b;
  --line: #d8e2db;
  --green: #1d533f;
  --primary: #173f33;
  --mint: #dff0ba;
  --amber: #704b0e;
  --red: #8e302a;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); line-height: 1.5; }
::selection { background: var(--mint); color: var(--ink); }
:focus-visible { outline: 3px solid #547d62; outline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-underline-offset: .2em; }
button { cursor: pointer; }
button:disabled, a[aria-disabled="true"] { cursor: default; opacity: .55; }
svg { display: inline-block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.symbols { position: absolute; }
.sr { clip: rect(0,0,0,0); clip-path: inset(50%); height: 1px; width: 1px; overflow: hidden; position: absolute; white-space: nowrap; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: clamp(2rem, 4.8vw, 3.35rem); font-weight: 760; line-height: 1.13; letter-spacing: -.037em; }
h2 { font-size: 1.2rem; letter-spacing: -.025em; font-weight: 720; line-height: 1.3; }
p { max-width: 65ch; }
.site-header { background: #f8faf7; border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1160px; min-height: 68px; margin: auto; padding: 0 26px; display: flex; align-items: center; gap: 40px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 740; white-space: nowrap; }
.brand-mark { background: var(--primary); color: var(--mint); border-radius: 9px; padding: 7px; display: grid; place-items: center; }
.header-inner nav { display: flex; align-items: stretch; gap: 21px; min-height: 68px; }
.header-inner nav button { color: var(--muted); border: 0; border-bottom: 1px solid transparent; background: transparent; padding: 3px 5px 0; white-space: nowrap; }
.header-inner nav button[aria-current="page"] { color: var(--primary); border-color: #497159; font-weight: 710; }
.logout { margin-left: auto; }
.main { max-width: 1160px; margin: 0 auto; padding: 49px 26px 70px; }
.heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 26px; }
.heading p { color: var(--muted); margin-top: 10px; }
.heading-date { color: var(--muted); font-size: .9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.capture-layout { display: grid; grid-template-columns: minmax(0, 1.77fr) minmax(265px, 1fr); gap: 24px; align-items: start; }
.capture-main { min-width: 0; }
.voice-panel { color: #fff; background: var(--primary); border-radius: 16px; padding: 28px 30px 21px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 20px; min-height: 200px; }
.voice-copy h2 { font-size: clamp(1.55rem, 3vw, 2.15rem); letter-spacing: -.035em; }
.voice-copy p { color: #f3faf1; margin-top: 6px; }
.voice-state { min-height: 1.4em; margin-top: 10px; font-size: .92rem; color: #e3efc2; overflow-wrap: anywhere; }
.voice-options { display: flex; grid-column: 1/-1; align-items: center; justify-content: space-between; color: #f3faf1; font-size: .875rem; border-top: 1px solid #527166; margin-top: 14px; padding-top: 4px; }
.record { width: 111px; min-height: 103px; display: flex; flex-flow: column; justify-content: center; align-items: center; gap: 7px; background: var(--mint); border: 0; border-radius: 14px; color: #203c2a; font-weight: 750; transition: background-color .18s, transform .18s; }
.record svg { width: 30px; height: 30px; }
.record:not(:disabled):hover { background: #ecf7ce; }
.record:not(:disabled):active { transform: scale(.97); }
.record.recording { background: #f7d9cb; color: #66271c; }
.record:focus-visible, .subtle:focus-visible { outline-color: var(--mint); }
.primary, .quiet, .subtle { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; padding: 8px 13px; min-height: 44px; font-weight: 690; white-space: nowrap; }
.primary { background: var(--green); color: #fff; border: 1px solid var(--green); }
.primary:hover { background: var(--primary); }
.quiet { border: 1px solid transparent; background: transparent; color: var(--green); }
.quiet:hover { background: #e9f2eb; }
.subtle { border: 0; background: transparent; color: #ecf7d4; padding-left: 0; padding-right: 9px; }
.subtle:hover { text-decoration: underline; }
input:not([type="checkbox"]), select, textarea { border: 1px solid #c8d7cc; background: var(--surface); border-radius: 8px; padding: 9px 11px; min-height: 43px; min-width: 0; }
input, textarea { caret-color: var(--green); }
textarea { resize: vertical; width: 100%; }
textarea::placeholder, input::placeholder { color: #53675d; opacity: 1; }
.text-form { margin-top: 20px; display: grid; gap: 9px; }
.text-form label, .login-form label { font-weight: 670; font-size: .95rem; }
.form-buttons, .actions { display: flex; gap: 8px; justify-content: space-between; }
.form-buttons .quiet { padding-left: 0; }
.mode-notice, .feedback { padding: 10px 13px; background: #e9f0e5; border-radius: 8px; font-size: .9rem; color: var(--primary); }
.mode-notice { margin-bottom: 15px; }
.feedback { margin-top: 12px; }
.feedback.error, .error { color: var(--red); }
.feedback.error { background: #fdece5; }
.question { background: #fdf1d6; color: #553909; padding: 16px 17px; border-radius: 12px; margin-top: 17px; }
.question ul { margin: 6px 0 4px; padding-left: 21px; }
.question p { font-size: .9rem; }
.section-head { display: flex; flex-wrap: wrap; gap: 5px 12px; align-items: center; justify-content: space-between; }
.section-head p { margin-top: 3px; color: var(--muted); font-size: .875rem; }
.draft-panel, .side, .ledger-section { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 17px 19px; }
.draft-panel { margin-top: 22px; }
.draft-panel .section-head, .side .section-head, .ledger-section .section-head { min-height: 42px; }
.empty { border-top: 1px solid var(--line); padding: 15px 0 3px; margin-top: 10px; color: var(--muted); font-size: .95rem; }
.transcript { margin: 8px 0 12px; padding: 10px 12px; border-radius: 7px; color: var(--muted); background: #f2f6f2; font-size: .875rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry-list { margin-top: 8px; }
.entry { padding: 13px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 13px; }
.entry-main, .entry-end { min-width: 0; }
.entry-main strong, .entry-main small, .entry-end strong { display: block; overflow-wrap: anywhere; }
.entry-main small { color: var(--muted); font-size: .875rem; margin-top: 4px; }
.entry-end { text-align: right; }
.entry-end strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.entry-end .quiet { padding: 3px 6px; font-size: .875rem; }
.kind { color: var(--green); font-size: .83rem; }
.kind.payment { color: #294e80; }
.kind.return, .pending { color: var(--amber); }
.draft-row { padding: 15px 0 12px; border-top: 1px solid var(--line); }
.draft-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 7px; }
.draft-top .quiet { min-width: 44px; padding: 6px; }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.field { display: flex; gap: 4px; flex-direction: column; font-size: .875rem; color: var(--muted); min-width: 0; }
.field input, .field select { width: 100%; font-size: 1rem; }
.field.wide { grid-column: 1 / -1; }
.row-feedback { margin-top: 9px; min-height: 22px; color: var(--muted); font-size: .875rem; }
.row-feedback.error { color: var(--red); }
.draft-actions { padding-top: 9px; border-top: 1px solid var(--line); }
.check { display: flex; align-items: center; gap: 8px; min-height: 43px; font-size: .95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.report-controls { display: flex; gap: 8px; align-items: center; }
.report-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #e4eee5; margin: 16px 0 20px; border-radius: 12px; padding: 10px; }
.metric { min-width: 0; padding: 9px 13px; }
.metric + .metric { border-left: 1px solid #c1d2c6; }
.metric dt { font-size: .875rem; color: var(--muted); }
.metric dd { font-size: clamp(1rem, 2.4vw, 1.4rem); font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.vendor-line { display: grid; gap: 5px; border-top: 1px solid var(--line); padding: 12px 0; }
.vendor-name { display: flex; justify-content: space-between; gap: 8px; align-items: start; overflow-wrap: anywhere; }
.vendor-line small { color: var(--muted); font-size: .875rem; }
.login-panel { max-width: 420px; margin: 20px auto; }
.login-form { display: grid; margin-top: 24px; gap: 11px; }
.setup-description { margin-top: 10px; color: var(--muted); }
#setup-needed { margin-top: 15px; }
#setup-needed a { margin-left: .3em; }
.loading { color: var(--muted); }
@media (max-width: 790px) {
  .capture-layout, .report-layout { grid-template-columns: minmax(0, 1fr); }
  .main { padding-top: 32px; }
}
@media (max-width: 520px) {
  .header-inner { padding: 9px 14px; min-height: 57px; column-gap: 9px; row-gap: 4px; flex-wrap: wrap; justify-content: space-between; }
  .brand { font-size: .96rem; gap: 6px; }
  .brand-mark { padding: 5px; }
  .brand-mark svg { width: 18px; height: 18px; }
  .header-inner nav { gap: 8px; min-height: 39px; }
  .header-inner nav button { font-size: .875rem; padding-inline: 2px; min-height: 42px; }
  .logout { margin: 0; padding: 3px 2px; font-size: .875rem; min-height: 38px; }
  .main { padding: 25px 14px max(30px, env(safe-area-inset-bottom)); }
  .heading { align-items: start; flex-direction: column; gap: 10px; margin-bottom: 15px; }
  .heading p { margin-top: 6px; }
  .heading-date { font-size: .875rem; }
  .voice-panel { min-height: 177px; padding: 18px 17px 11px; gap: 8px 12px; }
  .record { width: 91px; min-height: 88px; }
  .voice-options { margin-top: 7px; }
  .draft-panel, .side, .ledger-section { padding: 13px 12px; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px 4px; }
  .metric:nth-child(3) { border-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
