:root {
  --paper: #e8edf0;
  --surface: #f7f9fa;
  --ink: #142635;
  --muted: #65737d;
  --line: #cbd5da;
  --blue: #255d70;
  --blue-soft: #b9d0d7;
  --red: #bd4d3f;
  --shadow: 0 18px 60px rgba(24, 44, 57, .10);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(37, 93, 112, .25); outline-offset: 2px; }
.site-header { height: 68px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 clamp(20px, 5vw, 72px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; background: rgba(232,237,240,.94); backdrop-filter: blur(12px); }
.wordmark { color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: .06em; }
.wordmark span { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 9px; color: white; background: var(--ink); }
nav { display: flex; height: 100%; gap: 34px; }
nav a { position: relative; display: grid; place-items: center; color: var(--muted); text-decoration: none; font-size: 14px; }
nav a.active { color: var(--ink); font-weight: 700; }
nav a.active::after { content: ""; position: absolute; bottom: -1px; width: 100%; height: 3px; background: var(--red); }
.site-header form { justify-self: end; }
.quiet-button, .primary-button { border: 0; cursor: pointer; padding: 10px 16px; background: transparent; }
.danger-button { border: 0; padding: 10px 0; color: var(--red); background: transparent; cursor: pointer; }
.action-spacer { flex: 1; }
.quiet-button { color: var(--muted); }
.quiet-button:hover { color: var(--ink); background: rgba(255,255,255,.5); }
.primary-button { color: white; background: var(--ink); font-weight: 700; }
.primary-button:hover { background: var(--blue); }
.page-shell { width: min(1280px, calc(100% - 40px)); margin: 0 auto; padding: 52px 0 80px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.heading-note { max-width: 580px; margin: 14px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.heading-action { min-width: 112px; padding: 13px 22px; font-size: 14px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-family: Consolas, monospace; font-size: 11px; font-weight: 700; letter-spacing: .16em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(34px, 5vw, 60px); font-weight: 500; letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: 24px; font-weight: 500; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 0; padding: 11px 12px; background: var(--surface); }
input[type="month"] { cursor: pointer; }
textarea { resize: vertical; }
.month-control { grid-template-columns: auto 145px; align-items: center; }
.dashboard-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.hero-ledger { grid-column: span 8; min-height: 350px; padding: clamp(24px, 4vw, 48px); color: white; background: var(--ink); box-shadow: var(--shadow); overflow: hidden; }
.hero-top, .hero-meta, .panel header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hero-top { color: #b8c8d1; font-family: Consolas, monospace; letter-spacing: .08em; }
.status-pill { padding: 5px 9px; border: 1px solid #65808e; font: 11px Consolas, monospace; }
.status-pill.over { color: #ffd8d1; border-color: var(--red); }
.amount-label { margin: 52px 0 0; color: #9fb3be; font-size: 13px; }
.hero-amount { margin: 3px 0 25px; font-family: Georgia, serif; font-size: clamp(54px, 8vw, 94px); line-height: .95; letter-spacing: -.06em; }
.hero-amount::before { content: "¥"; margin-right: 10px; font: 22px Consolas, monospace; color: #9fb3be; }
.budget-track { height: 3px; background: #48606d; }
.budget-track i { display: block; height: 100%; max-width: 100%; background: #d7e7ec; transition: width .7s ease; }
.budget-track i.over { background: var(--red); }
.hero-meta { margin-top: 10px; color: #aabcc6; font-size: 12px; }
.pulse-strip { display: flex; align-items: end; gap: 3px; height: 47px; margin-top: 25px; opacity: .7; }
.pulse-strip i { flex: 1; min-height: 2px; background: #83aeba; transform-origin: bottom; animation: rise .5s both; }
.metric-rail { grid-column: span 4; min-width: 0; min-height: 350px; display: grid; grid-template-rows: repeat(3, 1fr); border-top: 3px solid var(--ink); background: rgba(247,249,250,.78); box-shadow: 0 8px 30px rgba(24,44,57,.05); }
.metric-card { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 20px 26px; border-bottom: 1px solid var(--line); }
.metric-card:last-child { border-bottom: 0; }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card span { margin-bottom: 7px; color: var(--ink); font-size: 13px; font-weight: 700; }
.metric-card small { max-width: 150px; font-size: 11px; line-height: 1.45; }
.metric-card strong { white-space: nowrap; text-align: right; font: 28px Georgia, serif; letter-spacing: -.02em; }
.panel { background: var(--surface); padding: 28px; box-shadow: 0 8px 30px rgba(24,44,57,.05); }
.category-panel { grid-column: span 5; }
.trend-panel { grid-column: span 7; }
.calendar-panel { grid-column: span 7; }
.summary-panel { grid-column: span 5; background: #d8e3e7; }
.summary-panel > p { margin: 30px 0 0; white-space: pre-wrap; line-height: 1.9; }
.summary-panel time { color: var(--muted); font: 11px Consolas, monospace; }
.category-bars { margin-top: 30px; display: grid; gap: 15px; }
.category-row { display: grid; grid-template-columns: 58px 1fr 78px; gap: 12px; align-items: center; font-size: 12px; }
.bar-track { height: 8px; background: #e1e7ea; }
.bar-track i { display: block; height: 100%; }
.category-row strong { text-align: right; font: 13px Consolas, monospace; }
.category-row em { margin-left: 5px; padding: 1px 3px; color: white; background: var(--red); font: normal 9px Consolas, monospace; }
.category-row.over strong { color: var(--red); }
.trend-chart { min-height: 245px; margin-top: 20px; overflow: hidden; }
.trend-chart svg { display: block; width: 100%; height: 220px; overflow: hidden; }
.trend-chart .grid { stroke: #dce3e6; stroke-width: 1; }
.trend-chart .line { fill: none; stroke: var(--blue); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.trend-chart .area { fill: rgba(57,122,139,.12); }
.trend-labels { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 10px; color: var(--muted); font: 13px Consolas, monospace; }
.trend-labels span:nth-child(2) { text-align: center; }
.trend-labels span:last-child { text-align: right; }
.calendar-chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; margin-top: 24px; }
.calendar-weekday { padding: 2px 0 6px; color: var(--muted); text-align: center; font: 11px Consolas, monospace; }
.calendar-day { min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; position: relative; color: var(--muted); background: #e7ecee; font: 600 14px Consolas, monospace; }
.calendar-day small { font: 10px Consolas, monospace; opacity: .82; }
.calendar-day[data-level="1"] { background: #d6e3e6; color: var(--ink); }
.calendar-day[data-level="2"] { background: #c5dadd; color: var(--ink); }
.calendar-day[data-level="3"] { background: #a7c6cc; color: var(--ink); }
.calendar-day[data-level="4"] { background: #89b2bb; color: var(--ink); }
.calendar-day[data-level="5"] { background: #6196a3; color: var(--ink); }
.calendar-day[data-level="6"] { background: #397a8b; color: white; }
.calendar-day[data-level="7"] { background: #286173; color: white; }
.calendar-day[data-level="8"] { background: #17495c; color: white; }
.calendar-day.empty { visibility: hidden; }
.calendar-legend { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 5px; margin-top: 8px; color: var(--muted); font: 10px Consolas, monospace; }
.calendar-legend i { width: 13px; height: 13px; background: #e7ecee; }
.calendar-legend i[data-level="1"] { background: #d6e3e6; }
.calendar-legend i[data-level="2"] { background: #c5dadd; }
.calendar-legend i[data-level="3"] { background: #a7c6cc; }
.calendar-legend i[data-level="4"] { background: #89b2bb; }
.calendar-legend i[data-level="5"] { background: #6196a3; }
.calendar-legend i[data-level="6"] { background: #397a8b; }
.calendar-legend i[data-level="7"] { background: #286173; }
.calendar-legend i[data-level="8"] { background: #17495c; }
.loading-line, .empty-state { padding: 50px; color: var(--muted); text-align: center; border: 1px dashed var(--line); }
.filter-row { display: grid; grid-template-columns: 180px 200px minmax(240px, 1fr); gap: 18px; margin-bottom: 20px; padding: 19px 22px; border-top: 3px solid var(--ink); background: rgba(247,249,250,.72); }
.filter-row label { gap: 9px; font-size: 13px; font-weight: 600; }
.filter-row input, .filter-row select { min-height: 44px; background: white; font-size: 14px; }
.search-field { justify-self: stretch; width: 100%; }
.ledger-list { overflow: hidden; background: var(--surface); box-shadow: 0 8px 30px rgba(24,44,57,.05); }
.ledger-entry { display: grid; grid-template-columns: 94px 130px minmax(0, 1fr) 140px 44px; align-items: center; gap: 20px; min-height: 76px; padding: 18px 24px; border-bottom: 1px solid #dce3e6; }
.ledger-entry:hover { background: white; }
.entry-date { font: 13px Consolas, monospace; color: var(--muted); letter-spacing: .03em; }
.category-tag { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; }
.category-tag i { flex: 0 0 auto; width: 9px; height: 9px; background: var(--category); }
.entry-detail strong, .entry-detail small { display: block; }
.entry-detail { min-width: 0; overflow-wrap: anywhere; }
.entry-detail strong { font-size: 15px; font-weight: 650; }
.entry-detail small { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.entry-amount { text-align: right; white-space: nowrap; font: 21px Georgia, serif; letter-spacing: -.01em; }
.entry-menu { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: stretch; gap: 18px; }
.settings-panel { height: 100%; padding: 34px; }
.settings-panel h2 { font-size: 28px; }
.settings-panel form { display: grid; gap: 20px; margin-top: 26px; }
.settings-grid > .settings-panel:not(.category-settings) { display: flex; flex-direction: column; }
.settings-grid > .settings-panel:not(.category-settings) form { flex: 1; display: flex; flex-direction: column; }
.settings-grid > .settings-panel:not(.category-settings) form .primary-button { align-self: flex-start; margin-top: auto; }
.settings-panel label { gap: 10px; font-size: 14px; font-weight: 600; }
.settings-panel input { min-height: 46px; background: white; font-size: 15px; font-weight: 400; }
.settings-panel form .primary-button { justify-self: start; }
.category-settings { grid-column: 1 / -1; }
.category-settings > header { padding-bottom: 6px; }
.category-settings-list { margin-top: 24px; }
.category-setting-row { display: grid; grid-template-columns: minmax(0, 1fr) 180px 80px; align-items: center; gap: 20px; min-height: 58px; padding: 13px 4px; border-top: 1px solid var(--line); }
.category-setting-row button { justify-self: end; }
.category-budget { font: 13px Consolas, monospace; color: var(--muted); }
dialog { width: min(520px, calc(100% - 30px)); border: 0; padding: 0; color: var(--ink); background: var(--surface); box-shadow: 0 25px 100px rgba(20,38,53,.3); }
dialog::backdrop { background: rgba(20,38,53,.55); backdrop-filter: blur(4px); }
dialog form { display: grid; gap: 18px; padding: 30px; }
dialog header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 8px; }
.dialog-close { border: 0; background: transparent; cursor: pointer; font-size: 25px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.checkbox-label { display: flex; align-items: center; gap: 9px; }
.checkbox-label input { width: auto; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: 360px; padding: 13px 18px; color: white; background: var(--ink); transform: translateY(100px); opacity: 0; transition: .25s; z-index: 30; }
.toast.show { transform: none; opacity: 1; }
.toast.error { background: var(--red); }
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-shell { width: min(960px, 100%); min-height: 590px; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--surface); box-shadow: var(--shadow); }
.login-mark { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; color: white; background: var(--ink); }
.month-stamp { align-self: start; padding: 7px 10px; border: 1px solid #718994; font-size: 12px; letter-spacing: .18em; }
.login-mark p { position: relative; z-index: 1; margin: 0; font: 30px/1.55 Georgia, "Noto Serif SC", serif; }
.pulse-lines { position: absolute; inset: 100px 30px 120px; display: flex; align-items: center; gap: 13px; transform: rotate(-8deg); }
.pulse-lines i { flex: 1; background: #4a7180; animation: breathe 3s ease-in-out infinite alternate; }
.pulse-lines i:nth-child(1), .pulse-lines i:nth-child(7) { height: 12%; }.pulse-lines i:nth-child(2), .pulse-lines i:nth-child(6) { height: 32%; }.pulse-lines i:nth-child(3), .pulse-lines i:nth-child(5) { height: 70%; }.pulse-lines i:nth-child(4) { height: 100%; background: var(--red); }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(35px, 7vw, 75px); }
.login-card h1 { font-size: clamp(42px, 6vw, 65px); line-height: 1.08; }
.login-card form { display: grid; gap: 16px; margin-top: 55px; }
.login-card button { display: flex; justify-content: space-between; border: 0; padding: 14px 17px; color: white; background: var(--ink); cursor: pointer; }
.form-error { margin: 0; color: var(--red); font-size: 12px; }
@keyframes rise { from { transform: scaleY(0); } }
@keyframes breathe { to { transform: scaleY(.75); opacity: .7; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 820px) {
  .site-header { grid-template-columns: 1fr auto; padding: 0 18px; }.wordmark { font-size: 0; }.wordmark span { margin: 0; }.site-header nav { position: fixed; bottom: 0; left: 0; right: 0; height: 58px; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--line); z-index: 20; }.site-header nav a { flex: 1; }.site-header nav a.active::after { top: -1px; bottom: auto; width: 35%; }.site-header form { grid-column: 2; }.page-shell { width: min(100% - 24px, 680px); padding: 34px 0 90px; }.page-heading { align-items: center; }.dashboard-heading { align-items: end; }.dashboard-grid { grid-template-columns: repeat(2, 1fr); }.hero-ledger, .metric-rail, .category-panel, .trend-panel, .calendar-panel, .summary-panel { grid-column: 1 / -1; }.metric-rail { min-height: auto; grid-template-columns: repeat(3, 1fr); grid-template-rows: none; }.metric-card { display: block; padding: 18px; }.metric-card:not(:last-child) { border-right: 1px solid var(--line); border-bottom: 0; }.metric-card strong { display: block; margin-top: 15px; text-align: left; font-size: 24px; }.filter-row { grid-template-columns: 1fr 1fr; padding: 17px; }.search-field { grid-column: 1 / -1; justify-self: stretch; width: auto; }.ledger-entry { grid-template-columns: 74px minmax(0, 1fr) 100px 32px; gap: 12px; padding: 16px 18px; }.ledger-entry .category-tag { display: none; }.entry-amount { font-size: 19px; }.settings-grid { grid-template-columns: 1fr; }.settings-panel { padding: 28px; }.category-settings { grid-column: auto; }.login-shell { grid-template-columns: 1fr; min-height: auto; }.login-mark { min-height: 230px; padding: 30px; }.login-mark p { font-size: 24px; }.login-card { padding: 40px 30px 48px; }.login-card form { margin-top: 38px; }
}
@media (max-width: 500px) { h1 { font-size: 36px; }.page-heading { align-items: start; }.expenses-heading { gap: 14px; }.heading-note { margin-top: 10px; font-size: 13px; }.heading-action { min-width: 92px; padding: 11px 15px; }.dashboard-heading { align-items: start; flex-direction: column; }.month-control { align-self: stretch; }.metric-rail { grid-template-columns: 1fr; grid-template-rows: repeat(3, auto); }.metric-card { display: grid; padding: 16px 18px; }.metric-card:not(:last-child) { border-right: 0; border-bottom: 1px solid var(--line); }.metric-card strong { margin-top: 0; text-align: right; font-size: 23px; }.panel { padding: 22px 18px; }.hero-ledger { padding: 25px 20px; min-height: 300px; }.hero-amount { font-size: clamp(40px, 14vw, 54px); }.trend-labels { font-size: 12px; }.calendar-chart { gap: 4px; }.calendar-day { min-height: 43px; font-size: 13px; }.filter-row { grid-template-columns: 1fr; gap: 13px; }.search-field { grid-column: auto; }.ledger-entry { grid-template-columns: 64px minmax(0, 1fr) 29px; }.ledger-entry .entry-amount { grid-column: 2; grid-row: 2; text-align: left; }.ledger-entry .entry-menu { grid-column: 3; grid-row: 1 / 3; }.settings-panel { padding: 24px 20px; }.settings-panel h2 { font-size: 25px; }.form-grid { grid-template-columns: 1fr; }.category-setting-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }.category-budget { grid-column: 1; }.category-setting-row button { grid-column: 2; grid-row: 1 / 3; } }
