@font-face{font-family:'Source Han Serif TC';font-style:normal;font-weight:200 900;font-display:swap;src:local('Source Han Serif TC'),local('思源宋體'),url('https://cdn.jsdelivr.net/gh/adobe-fonts/source-han-serif@release/Variable/WOFF2/OTF/Subset/SourceHanSerifTW-VF.otf.woff2') format('woff2')}
:root{--paper:#f7f3e9;--ink:#3d3935;--muted:#756a61;--line:#d6c4b3;--green:#985947;--light:#eee4d7;--red:#a43b35;--paper-grid:linear-gradient(#a75c4212 1px,transparent 1px),linear-gradient(90deg,#a75c4212 1px,transparent 1px);--writing-font:'Source Han Serif TC','Source Han Serif TW',serif}
body,button,input,select,textarea,h1,h2,h3,svg text{font-family:var(--writing-font)!important}body{background-color:var(--paper);background-image:var(--paper-grid);background-size:26px 26px}
.bookmark-tabs{grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}.bookmark-tabs button{background:#e9dfd0;border-radius:2px 2px 0 0;letter-spacing:1px}.bookmark-tabs button[aria-selected=true]{background:#fcfaf4;border-color:#b9a08c;color:#8b4d3b}.bookmark-tabs button[aria-selected=true]::after{background:#fcfaf4}
.app-shell .daily-card,.tab-panel,dialog{background-color:#fcfaf4;background-image:var(--paper-grid);background-size:26px 26px;border:1px solid #c9ae97;border-radius:2px;box-shadow:3px 3px 0 #b6a08a22}
.app-shell .daily-entry,.fixed-card{background:#fffdf6db;border-color:#d9c4b2;border-radius:2px}.app-shell .daily-entry.done{background:#e9e6d8e6}.entry-symbol{border-radius:1px;border-color:#d6c4b3}.app-shell .daily-total strong{letter-spacing:1px}.app-shell .day-navigation #dayToday{background:#fcfaf4;border-radius:2px}.card-heading,.card-bottom{border-color:#d6c4b3}
button,input,select{border-radius:2px}input,select{background:#fffdf7}.panel-title h2{letter-spacing:2px}.panel-title label{margin-top:16px;max-width:240px}.panel-title input{font-size:1rem}#budgetSummary{margin-top:10px;line-height:1.8}
#weekdays.weekdays{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));font-size:.875rem;padding-bottom:8px}#calendar.calendar{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));border:0;gap:4px;margin-bottom:16px}
.calendar-day{display:flex;flex-direction:column;align-items:center;justify-content:space-between;min-width:0;min-height:66px;padding:7px 2px;font-size:1rem;border:1px solid #dac7b6;background:#fffdf6db;line-height:1.5}.calendar-day small{font-size:.75rem;white-space:nowrap;font-variant-numeric:tabular-nums}.calendar-day.today{border:2px solid #985947;padding:6px 1px;background:#f2e6d9}.calendar-day.previous-cycle{background:#eee8ded9;color:#877d75;border-style:dashed}.calendar-empty{min-height:66px}
.calendar-section .section-heading{margin-top:26px}.calendar-section .legend{font-size:.75rem}.expense-list{list-style:none;padding:0;margin:0}.expense-list li{display:flex;justify-content:space-between;gap:16px;border-bottom:1px solid var(--line);padding:14px 0;align-items:center}.expense-list li strong{font-size:1rem;font-weight:500;overflow-wrap:anywhere}.expense-list li small{display:block;font-size:.8125rem;color:var(--muted)}.expense-list li>span{white-space:nowrap;font-variant-numeric:tabular-nums}.details-total{text-align:right;font-size:1.2rem;padding-top:12px}.empty-state{padding:20px 0;color:var(--muted);font-size:.875rem;line-height:1.8}
.subscription-row{padding:16px 0;border-bottom:1px solid var(--line)}.subscription-row .row-top>label{flex:1}.sub-remove{color:var(--red);align-self:end;margin-bottom:2px}.subscription-row+.subscription-row{margin-top:8px}#addSubscription{margin-top:16px}.chart-section{margin-bottom:26px;padding-bottom:22px;border-bottom:1px solid var(--line)}.chart-section h3{font-size:1rem;margin-bottom:14px}.spending-chart{display:flex;align-items:center;gap:12px}.spending-chart svg{width:150px;max-width:42%;flex-shrink:0}.chart-legend{padding:0;margin:0;list-style:none;flex:1;min-width:0}.chart-legend li{display:grid;grid-template-columns:8px 1fr;gap:3px 7px;align-items:center;margin:12px 0;font-size:.875rem}.color-key{width:8px;height:8px}.chart-legend strong{grid-column:2;font-size:.875rem;font-weight:500;overflow-wrap:anywhere}.chart-legend small{grid-column:2;font-size:.75rem;color:var(--muted)}
.budget-bar-row{margin:0 0 18px}.budget-bar-row>div:first-child{display:flex;justify-content:space-between;gap:8px;align-items:center;font-size:.875rem}.budget-bar-row small{font-size:.8125rem}.budget-track{height:9px;margin:8px 0;background:#e7dfd2}.budget-track span{display:block;height:100%}.budget-bar-row p{font-size:.8125rem;text-align:right}.saving-plan{padding-top:8px;font-size:.875rem}.saving-plan p{line-height:1.8;margin-top:7px}#trendChart svg{width:100%;height:auto;display:block}#trendChart p,#analysisNote{font-size:.8125rem;line-height:1.8}.chart-section table{width:100%;border-collapse:collapse;font-size:.875rem}.chart-section caption{text-align:left;margin-bottom:12px}.chart-section th,.chart-section td{padding:9px 0;border-bottom:1px solid var(--line);text-align:left}.chart-section td:last-child,.chart-section th:last-child{text-align:right}.font-credit{font-size:.75rem;color:var(--muted);line-height:1.8}
.app-shell .date-jump input{font-size:.875rem;width:138px}.app-shell .card-heading h1{font-size:clamp(1.5rem,3.8dvh,2rem)}
@media(max-width:360px){.bookmark-tabs{padding:0 4px}.bookmark-tabs button{font-size:.8125rem;letter-spacing:0}.app-shell .card-heading{gap:6px}.app-shell .card-heading h1{font-size:1.35rem}.app-shell .date-jump input{width:124px}.calendar-day{min-height:58px;font-size:.875rem}.calendar-empty{min-height:58px}.calendar-day small{font-size:.6875rem}.spending-chart{gap:6px}.chart-legend li,.chart-legend strong{font-size:.8125rem}}
/* 日期狀態只改稿紙與配色；超支優先，文字仍維持思源宋體。 */
.app-shell .daily-card.is-other-day{--muted:#555b60;--green:#525c64;--paper-grid:linear-gradient(#636d791c 1px,transparent 1px),linear-gradient(90deg,#636d791c 1px,transparent 1px);background-color:#e9eaeb;border-color:#91989e;color:#30373c}
.app-shell .daily-card.is-other-day .daily-entry{background:#f3f3f3bd;border-color:#aab0b5}
.app-shell .daily-card.is-over-budget{--muted:#783b37;--green:#873b32;--paper-grid:linear-gradient(#a238352a 1px,transparent 1px),linear-gradient(90deg,#a238352a 1px,transparent 1px);background-color:#f7dcd6;border-color:#af4a40;color:#512721}
.app-shell .daily-card.is-over-budget .daily-entry{background:#fff2ecce;border-color:#c78176}
.app-shell .daily-card.is-over-budget .day-badge{color:#8b241d;font-weight:700}
.app-shell .daily-card.is-other-day .card-heading,.app-shell .daily-card.is-other-day .card-bottom{border-color:#aab0b5}
.app-shell .daily-card.is-over-budget .card-heading,.app-shell .daily-card.is-over-budget .card-bottom{border-color:#c78176}
.app-shell .daily-total{width:100%}
@media(max-height:620px){.app-shell .daily-total>p{font-size:.75rem;line-height:1.3}.app-shell .daily-total strong{font-size:1.5rem;margin:2px 0}.app-shell .daily-total .budget-note{font-size:.6875rem}.app-shell .card-bottom{padding-top:6px}}

.app-shell .daily-budget-details{text-align:left;color:var(--muted);font-size:.8125rem;line-height:1.5;margin-top:8px}
.app-shell .daily-budget-details p,.app-shell .daily-budget-details .budget-note{font-size:inherit;line-height:inherit;font-weight:400;color:inherit;margin:0;overflow-wrap:anywhere}
.app-shell .daily-budget-details p.negative{color:var(--red)}
@media(max-height:620px){.app-shell .daily-budget-details{font-size:.75rem;line-height:1.3;margin-top:4px}}

#googleConfig{width:100%;max-width:100%;padding:10px;border:1px solid var(--line);background:#fffdf7;color:var(--ink);font-size:.8125rem}#googleIdentity{overflow-wrap:anywhere}#googleStatus{font-size:.875rem;line-height:1.6;margin:12px 0}#googleLogin{margin:16px 0 8px;min-height:44px}.google-actions{display:grid;gap:10px}.google-actions button{min-height:44px}.backup-heading{margin-top:24px!important}

/* 既有稿紙配色；逐字跳起並沿 Y 軸轉兩圈，落地後小彈。 */
.sync-coin{display:inline-flex;gap:.025em;align-items:baseline;perspective:650px;white-space:nowrap;color:var(--green);font-weight:500;line-height:1.7;padding-top:.7em}
.sync-coin.is-guest,.sync-coin.is-pending{color:var(--ink)}
.coin-letter{display:inline-block;transform-origin:50% 75%;transform-style:preserve-3d;animation:sync-coin-flip 2.4s cubic-bezier(.3,.05,.2,1) infinite;animation-delay:calc(var(--coin-index) * .14s);will-change:transform}
.sync-detail{font:inherit;color:inherit;overflow-wrap:anywhere}
.app-shell .sync-badge{flex-shrink:0;align-self:center;font-size:clamp(1.1rem,4.9vw,1.65rem);line-height:1.4;text-align:right}
.sync-badge .sync-coin{font-weight:700;line-height:1.35}
@media(max-width:370px){.app-shell .card-heading{flex-wrap:wrap;column-gap:6px;row-gap:0}}
#loginPrompt{max-width:min(26rem,calc(100% - 24px));line-height:1.7}#loginPrompt .dialog-actions{flex-wrap:wrap}#loginPrompt button{min-height:44px}
@keyframes sync-coin-flip{0%,8%{transform:translateY(0) rotateY(0deg)}25%{transform:translateY(-.65em) rotateY(360deg)}43%{transform:translateY(0) rotateY(720deg)}52%{transform:translateY(-.2em) rotateY(720deg)}62%,100%{transform:translateY(0) rotateY(720deg)}}
@media(prefers-reduced-motion:reduce){.coin-letter{animation:none;transform:none;will-change:auto}.sync-coin{padding-top:0}}
.amount-field{min-width:0}
.amount-input{font-size:1rem;font-variant-numeric:tabular-nums}
.amount-keys{display:none;grid-template-columns:repeat(auto-fit,minmax(40px,1fr));gap:4px;margin:4px 0 8px}
.amount-field.active .amount-keys,.amount-field:has(#ma) .amount-keys{display:grid}
.amount-keys button{min-height:44px;padding:3px;color:var(--green);background:var(--paper);font-size:1.15rem}
.amount-keys button:last-child{background:var(--light);font-weight:700}
.clear-original{color:var(--green);font-size:.875rem}
@media(max-width:520px){#editor .fields:has(.amount-field){grid-template-columns:1fr}}
