:root {
  color-scheme: light;
  --paper: #faf6ec;
  --surface: #fffdf7;
  --ink: #203d36;
  --teal: #173f3b;
  --muted: #626c60;
  --line: #dcd9c9;
  --peach: #f4b28a;
  color: var(--ink);
  background: var(--paper);
  font-family: "PingFang SC","Microsoft YaHei",system-ui,sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, textarea { color: inherit; font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #ca7347; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; clip-path:inset(50%); overflow:hidden; white-space:nowrap; }
.masthead, .page { width: min(1060px, calc(100% - 56px)); margin: auto; }
.masthead { display: flex; justify-content: space-between; align-items: center; min-height: 80px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 1.04rem; font-weight: 680; }
.brand img { display: block; border-radius: 11px; }
nav { display: flex; gap: 18px; align-items: center; }
nav a, nav button, .notice button { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; color: #41594d; background: none; border: none; padding: 0; font-size: .86rem; }
nav a:hover, nav button:hover, .notice button:hover, .edit:hover { text-decoration: underline; }
.page { padding-bottom: max(60px, env(safe-area-inset-bottom)); }
.cover { isolation: isolate; position: relative; display: flex; align-items: center; min-height: 257px; overflow: hidden; padding: 33px clamp(27px, 5.4vw, 66px); border-radius: 6px 25px 25px 6px; background: linear-gradient(108deg,#173f3b 0%,#204c44 65%,#2e6153 100%); box-shadow: inset 6px 0 #cf9472; color: #fff1d4; }
.cover::before { content:""; position: absolute; inset: 0 auto 0 13px; border-left: 1px dashed #c2c49685; }
.cover-copy { position: relative; z-index: 1; }
.cover-copy h1 { font: 700 clamp(2.2rem, 5.2vw, 3.9rem)/1.18 "Songti SC","STSong","Noto Serif CJK SC",Georgia,serif; letter-spacing: -.045em; }
.cover-copy h1 span { color: #ffd2a4; }
.cover-copy > p { margin: 12px 0 22px; color: #e8ead7; font-size: .97rem; line-height: 1.65; }
.cover-copy .loading { margin: 0; min-height: 45px; display: flex; align-items: center; font-size: .87rem; }
.peach-button, .primary, .secondary, .danger { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; padding: 10px 20px; border-radius: 30px; border: 1px solid transparent; font-weight: 650; font-size: .93rem; line-height: 1.25; }
.peach-button { background: #f7ba93; color: #223b32; box-shadow: 0 2px 0 #142f29; }
.peach-button:hover { background: #ffcaa7; }
.peach-button span { font-size: 1.12em; line-height: 1; }
.cover-art { z-index: -1; position: absolute; width: min(39%, 390px); height: 100%; right: 3%; bottom: 0; }
.summary, .panel { min-width: 0; }
.summary { margin: 27px 0 17px; }
.section-heading, .dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h2, .dialog-heading h2, #confirmation h2 { font: 700 1.37rem/1.45 "Songti SC","STSong","Noto Serif CJK SC",Georgia,serif; letter-spacing: -.035em; }
.section-heading > span, .chart-caption { font-size: .8rem; color: var(--muted); }
.metric-strip { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin-top: 12px; background: #fffaf0; border: 1px solid #d8d0ba; border-radius: 15px; overflow: hidden; }
.metric { position: relative; padding: 17px clamp(15px, 3.3vw, 37px) 20px; }
.metric + .metric::before { content: ""; position: absolute; left: 0; top: 21px; bottom: 21px; border-left: 1px dashed #d3c9b0; }
.metric h3 { display: flex; align-items: center; gap: 6px; color: var(--tone); font-size: .89rem; font-weight: 660; }
.metric-height { --tone:#3c695b; }.metric-weight { --tone:#925536; }.metric-head { --tone:#715c79; }
.metric svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.metric > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; margin: 5px 0 3px; }
.metric strong { font: 580 clamp(1.85rem, 4vw, 2.9rem)/1.17 ui-rounded,system-ui,sans-serif; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.metric strong + span, .metric small { font-size: .8rem; color: var(--muted); }
.details { display: grid; grid-template-columns: 1.12fr 1fr; gap: 17px; align-items: start; }
.panel { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: clamp(17px, 2.6vw, 29px); }
.trend { background-image: linear-gradient(#f7f1e466 1px,transparent 1px),linear-gradient(90deg,#f7f1e466 1px,transparent 1px); background-size: 18px 18px; }
.switch { display: inline-flex; margin: 14px 0 1px; padding: 2px; border: 1px solid #d6d9c9; border-radius: 28px; background: #f3f4e9; }
.switch button { background: none; min-width: 56px; min-height: 38px; border: none; padding: 7px 13px; border-radius: 25px; font-size: .82rem; font-weight: 600; color: #4c6152; }
.switch button[aria-pressed="true"] { color: #fff9e9; background: #36594b; }
.chart-area { display: grid; align-items: center; min-height: 155px; margin-top: 10px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill:#586458; font: 12px system-ui,sans-serif; }
.chart-caption { padding-top: 7px; }
.empty { position: relative; color: var(--muted); text-align: center; padding: 34px 10px; font-size:.88rem; line-height: 1.65; }
.chart-area .empty { margin: auto 0; padding: 25px 12px; background: #faf7eddd; border: 1px dashed #d6d2bf; border-radius: 8px; }
#history-list { margin-top: 13px; }
.history-row { display: grid; grid-template-columns: 65px minmax(0,1fr) auto; gap: 0 13px; padding: 14px 0; border-top: 1px solid #e5decc; align-items: start; }
.history-row time { display: flex; flex-direction: column; align-items: start; line-height: 1.25; }
.history-row time b { font: 640 1.12rem/1.4 ui-rounded,system-ui,sans-serif; color: #395646; }
.history-row time small { font-size: .75rem; color: var(--muted); }
.history-values { display: flex; flex-wrap: wrap; gap: 5px 13px; line-height: 1.55; padding-top: 2px; }
.history-values span { font-size:.87rem; }
.history-note { grid-column: 2 / -1; margin-top:5px; font-size:.82rem; color:var(--muted); line-height:1.6; white-space:pre-wrap; overflow-wrap:anywhere; }
.edit, .danger-link { background: transparent; border: 0; min-height: 40px; color: #3e6353; padding: 0 2px; font-size: .83rem; }
.edit { align-self: center; }
.notice, .error { background:#ffebdb; border:1px solid #eed2ba; color:#723d20; padding:11px 13px; font-size:.87rem; line-height:1.6; border-radius:9px; }
.notice { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:15px; }
.notice button { flex:none; min-height:35px; text-decoration:underline; }
dialog { width:min(462px, calc(100vw - 26px)); max-height:calc(100vh - 26px); max-height:calc(100dvh - 26px); overflow:auto; padding:24px; border:1px solid #d5cdb8; border-radius:20px; color:var(--ink); background:var(--paper); box-shadow:0 14px 70px #152e2440; }
dialog::backdrop { background:#132c25a6; }
.dialog-heading { border-bottom:1px solid var(--line); padding-bottom:12px; margin: -4px 0 17px; }
.close { border:0; width:42px; height:42px; border-radius:50%; background:#eceadd; font-size:1.5rem; line-height:1; }
.field, legend { display:block; font-size:.9rem; font-weight:620; }
.field { margin: 16px 0; }
.field > small, legend small { font-size:.77rem; color:var(--muted); font-weight:400; margin-left:4px; }
input, textarea { display:block; width:100%; min-width:0; border-radius:9px; border:1px solid #c9cebd; background:var(--surface); font-size:16px; font-weight:400; color:var(--ink); padding:10px 12px; }
input { min-height:46px; } textarea { resize:vertical; }
input[type="date"] { -webkit-appearance:none; }
.field > input, .field > textarea, .input-unit { margin-top:6px; }
fieldset { padding:0; margin:17px 0 0; border:0; }
legend { padding:0; }
.number-fields { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.number-fields .field { margin:10px 0 0; }
.input-unit { display:block; position:relative; }
.input-unit input { padding-right:29px; appearance:textfield; }
.input-unit input::-webkit-inner-spin-button { -webkit-appearance:none; }
.input-unit small { position:absolute; pointer-events:none; right:8px; top:50%; transform:translateY(-50%); font-size:.73rem; color:var(--muted); }
.dialog-actions { margin-top:20px; display:flex; align-items:center; justify-content:flex-end; gap:9px; flex-wrap:wrap; }
.primary { background:var(--teal); color:#fff8e8; }
.primary:hover { background:#2e574a; }
.secondary { border-color:#c7cbb9; background:transparent; }
.danger { color:white; background:#8c4134; }
.danger-link { color:#8a4434; margin-right:auto; }
#delete-description { margin:12px 0; color:var(--muted); line-height:1.6; font-size:.91rem; }
@media (max-width: 750px) {
  .details { grid-template-columns:1fr; }
  .cover-art { width:38%; right:0; }
  .cover { min-height:225px; }
}
@media (max-width: 550px) {
  .masthead, .page { width:calc(100% - 28px); }
  .masthead { min-height:64px; }
  .brand { font-size:.93rem; gap:7px; }
  .brand img { width:32px; height:32px; border-radius:9px; }
  nav { gap:12px; } nav a, nav button { font-size:.8rem; }
  .cover { min-height:209px; padding:22px 20px 26px 25px; align-items:start; border-radius:5px 17px 17px 5px; box-shadow:inset 4px 0 #cf9472; }
  .cover::before { left:9px; }
  .cover-copy h1 { font-size:clamp(1.72rem, 7.4vw, 2.2rem); }
  .cover-copy > p { max-width:17em; margin:8px 0 17px; font-size:.78rem; }
  .cover-art { width:45%; height:auto; bottom:-1%; right:-1%; max-height:120px; }
  .peach-button { padding:10px 14px; font-size:.85rem; }
  .summary { margin:21px 0 12px; }
  .section-heading h2 { font-size:1.23rem; }
  .section-heading > span { font-size:.73rem; }
  .metric-strip { margin-top:9px; border-radius:12px; }
  .metric { padding:12px 8px 13px 11px; }
  .metric + .metric::before { top:13px; bottom:13px; }
  .metric h3 { gap:3px; font-size:.83rem; }
  .metric svg { width:18px; height:18px; }
  .metric > div { gap:3px; }
  .metric strong { font-size:clamp(1.38rem,6.5vw,1.9rem); }
  .metric strong + span,.metric small { font-size:.67rem; }
  .details { gap:12px; } .panel { padding:16px; border-radius:13px; }
  .switch { margin-top:10px; }
  .switch button { min-height:40px; min-width:59px; }
  .chart-area { min-height:138px; }
  .history-row { grid-template-columns:54px minmax(0,1fr) auto; gap:0 9px; }
  .history-values { gap:3px 9px; }
  .edit { min-width:36px; min-height:44px; }
  dialog { width:100%; max-width:100%; margin:auto 0 0; padding:18px 18px max(20px,env(safe-area-inset-bottom)); border-radius:20px 20px 0 0; }
  .dialog-actions .primary,.dialog-actions .secondary,.dialog-actions .danger { padding:10px 16px; }
}
@media(max-width:350px) {
  .masthead, .page { width:calc(100% - 20px); }
  .cover-art { width:38%; }
  .metric { padding-left:8px; }
  .number-fields { gap:5px; }
  .number-fields input { padding-left:6px; }
}

@media(min-width:751px) {
  .cover:has(#login-panel:not([hidden])) { min-height:338px; }
  .cover:has(#login-panel:not([hidden])) .cover-art { width:42%; right:4%; }
}
@media(max-width:550px) {
  .cover:has(#login-panel:not([hidden])) { min-height:285px; padding-top:29px; }
  .cover:has(#login-panel:not([hidden])) .cover-art { width:58%; max-height:154px; right:1%; bottom:1%; }
}
