:root {
  color-scheme: light;
  --paper: #f7f1e8;
  --ink: #312a24;
  --muted: #7d7267;
  --caramel: #bd6829;
  --caramel-dark: #8f481f;
  --cream: #ead8c2;
  --line: rgba(63, 45, 31, 0.12);
  --white: rgba(255, 253, 249, 0.84);
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); line-height: 1.7; }
.eyebrow { margin: 0 0 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; letter-spacing: .15em; color: var(--caramel-dark); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 72% 18%, #efdcc6 0 12%, transparent 42%), linear-gradient(135deg, #fbf7f0, #efe1d0); }
.login-card { width: min(460px, 100%); padding: 52px; background: rgba(255,253,249,.76); border: 1px solid rgba(91,61,38,.12); border-radius: 28px 9px 28px 9px; box-shadow: 0 30px 80px rgba(91,61,38,.12); backdrop-filter: blur(16px); }
.mark { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 32px; border-radius: 50%; background: var(--caramel); color: white; font: 600 24px Georgia, serif; }
.login-card h1 { margin: 0; font-size: clamp(34px, 7vw, 52px); line-height: 1.12; font-weight: 600; letter-spacing: -.04em; }
.login-card form { margin-top: 32px; }
.login-card label { display: block; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.password-row { display: flex; gap: 8px; }
.password-row input { min-width: 0; flex: 1; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: #fffdf9; outline: none; }
.password-row input:focus { border-color: var(--caramel); box-shadow: 0 0 0 3px rgba(189,104,41,.12); }
.password-row button { padding: 0 20px; color: white; border: 0; border-radius: 12px; background: var(--caramel); }
.form-error, .load-error { min-height: 20px; color: #a6422e; font-size: 13px; }
.app-shell { min-height: 100vh; }
.side-nav { position: fixed; inset: 0 auto 0 0; width: 220px; padding: 28px 22px; display: flex; flex-direction: column; background: #efe3d4; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 50px; font-size: 20px; }
.brand span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--caramel); }
.side-nav nav { display: grid; gap: 8px; }
.nav-item { padding: 12px 14px; text-align: left; color: var(--muted); border: 0; border-radius: 10px; background: transparent; }
.nav-item.active { color: var(--caramel-dark); background: rgba(255,253,249,.7); box-shadow: inset 3px 0 var(--caramel); }
.side-bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.secure-dot::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #5e8a55; }
.text-button { padding: 4px; border: 0; color: var(--muted); background: transparent; }
.content { margin-left: 220px; width: min(1220px, calc(100% - 220px)); padding: 38px clamp(24px, 4vw, 64px) 80px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.topbar h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.04em; font-weight: 600; }
.month-picker { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.month-picker input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--white); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); gap: 16px; }
.hero-card { min-height: 300px; padding: 30px; display: flex; flex-direction: column; justify-content: space-between; color: #fffaf2; border-radius: 26px 8px 26px 8px; overflow: hidden; background: linear-gradient(145deg, #bd6829, #93461e); box-shadow: 0 20px 45px rgba(117,59,25,.2); }
.hero-card p { margin: 0 0 8px; opacity: .8; }
.hero-card strong { font: 600 clamp(48px, 7vw, 76px)/1 Georgia, serif; letter-spacing: -.04em; }
.hero-note { align-self: flex-start; padding: 7px 11px; border: 1px solid rgba(255,255,255,.18); border-radius: 99px; background: rgba(255,255,255,.08); }
.sparkline { height: 82px; }
.sparkline svg { width: 100%; height: 100%; overflow: visible; }
.mini-stack { display: grid; gap: 16px; }
.metric-card { padding: 25px; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--line); border-radius: 8px 24px 8px 24px; background: var(--white); }
.metric-card span, .metric-card small { color: var(--muted); }
.metric-card strong { margin: 12px 0 8px; font: 600 34px Georgia, serif; }
.detail-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; margin-top: 16px; }
.panel { padding: 26px; border: 1px solid var(--line); border-radius: 18px 6px 18px 6px; background: var(--white); }
.panel header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.panel h2 { margin: 0; font-size: 22px; font-weight: 600; }
.chip { padding: 6px 10px; color: var(--caramel-dark); border-radius: 99px; background: #f2dfcb; font-size: 12px; }
.category-list { display: grid; gap: 18px; }
.category-row { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: center; }
.category-name { font-size: 14px; }
.bar { height: 8px; border-radius: 99px; background: #eadfd2; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--caramel); }
.category-amount { font: 14px Georgia, serif; }
.merchant-list { margin: 0; padding: 0; list-style: none; counter-reset: merchant; }
.merchant-list li { counter-increment: merchant; display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.merchant-list li::before { content: counter(merchant, decimal-leading-zero); color: var(--caramel); font: 11px ui-monospace, monospace; }
.merchant-list li:last-child { border-bottom: 0; }
.merchant-list b { font: 500 14px Georgia, serif; }
.empty { color: var(--muted); font-size: 14px; }
.transaction-panel { min-height: 420px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 14px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; font-weight: 400; }
td.amount { text-align: right; font: 600 15px Georgia, serif; }
.status { padding: 4px 8px; border-radius: 99px; color: #53704e; background: #e5eee1; font-size: 11px; }
.status.pending { color: #9a6328; background: #f4e5cf; }
.empty-cell { padding: 70px 12px; text-align: center; color: var(--muted); }
.mobile-nav { display: none; }
@media (max-width: 760px) {
  .side-nav { display: none; }
  .content { margin: 0; width: 100%; padding: max(24px, env(safe-area-inset-top)) 16px calc(92px + env(safe-area-inset-bottom)); }
  .topbar { align-items: center; margin-bottom: 24px; }
  .topbar h1 { font-size: 30px; }
  .hero-grid, .detail-grid { grid-template-columns: 1fr; }
  .hero-card { min-height: 270px; padding: 24px; }
  .hero-card strong { font-size: 49px; }
  .mini-stack { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 142px; padding: 18px; }
  .metric-card strong { font-size: 25px; }
  .panel { padding: 20px; }
  .mobile-nav { position: fixed; inset: auto 14px calc(12px + env(safe-area-inset-bottom)) 14px; z-index: 5; display: grid; grid-template-columns: 1fr 1fr; padding: 7px; border: 1px solid var(--line); border-radius: 17px; background: rgba(249,244,237,.9); box-shadow: 0 12px 35px rgba(70,44,25,.16); backdrop-filter: blur(14px); }
  .mobile-nav .nav-item { text-align: center; }
  .mobile-nav .nav-item.active { box-shadow: none; color: white; background: var(--caramel); }
  .login-card { padding: 36px 26px; }
  .password-row { flex-direction: column; }
  .password-row button { min-height: 48px; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero-card, .panel, .metric-card { animation: rise .45s ease both; }
  .panel { animation-delay: .08s; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } }
}
