:root {
  --bg: #05090f;
  --panel: rgba(13, 19, 29, 0.82);
  --panel-2: rgba(9, 14, 21, 0.9);
  --line: rgba(88, 118, 158, 0.2);
  --ink: #e8eef7;
  --muted: #8295ac;
  --dim: #5a6779;
  --accent: #7dd3fc;
  --warn: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 78% -8%, rgba(40, 90, 140, 0.28), transparent 62%),
    radial-gradient(880px 520px at 8% 12%, rgba(24, 70, 110, 0.2), transparent 58%),
    linear-gradient(180deg, #060a11, #04070c 60%, #05090f);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 22px 72px;
}

/* ---------- nav ---------- */

.top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 26px 0 30px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 34px;
}

@font-face {
  font-family: "SuishiJi";
  src: url("/assets/suishiji.woff") format("woff");
  font-display: swap;
}

.brand {
  font-family: "SuishiJi", "STXingkai", "华文行楷", "FZYTK", "方正舒体", "STKaiti", "楷体", ui-serif, serif;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0.1em;
  color: var(--ink);
  font-weight: 400;
  margin-right: auto;
  padding-right: 4px;
  transform: translateY(2px);
  text-shadow: 0 0 0.6px currentColor;
}

.top a.navlink {
  font-size: 13px;
  color: var(--dim);
  padding: 4px 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.18s, border-color 0.18s;
}

.top a.navlink:hover { color: var(--muted); }

.top a.navlink.on {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ---------- type ---------- */

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 10px;
}

h1, h2, h3 { margin: 0; font-weight: 500; }

.hero {
  font-size: 46px;
  font-weight: 250;
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin: 2px 0 6px;
}

.hero small {
  font-size: 20px;
  font-weight: 300;
  color: var(--muted);
  margin-left: 4px;
  letter-spacing: 0;
}

.sub {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.section { margin-top: 46px; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 500;
}

.section-head .more {
  margin-left: auto;
  font-size: 12px;
  color: var(--dim);
  border-bottom: 1px solid var(--line);
}

.section-head .more:hover { color: var(--muted); }

/* ---------- panel ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  overflow: hidden;
}

.pad { padding: 20px 22px; }

/* ---------- stat strip ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 28px;
}

.stat {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stat .k {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.stat .v {
  font-size: 24px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
  letter-spacing: -0.01em;
}

/* ---------- category bars ---------- */

.cat {
  display: grid;
  grid-template-columns: 96px 1fr 96px;
  align-items: center;
  gap: 14px;
  padding: 11px 22px;
  border-bottom: 1px solid rgba(88, 118, 158, 0.12);
}

.cat:last-child { border-bottom: 0; }

.cat .name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.track {
  height: 4px;
  background: rgba(120, 150, 190, 0.12);
  border-radius: 2px;
  overflow: hidden;
}

.track i {
  display: block;
  height: 100%;
  border-radius: 2px;
}

.cat .val {
  text-align: right;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- rows ---------- */

.row {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  border-bottom: 1px solid rgba(88, 118, 158, 0.12);
}

.row:last-child { border-bottom: 0; }

.row .day {
  font-size: 12px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.row .what { font-size: 13.5px; }

.row .what em {
  font-style: normal;
  color: var(--dim);
  font-size: 12px;
  margin-left: 10px;
}

.row .amt {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* ---------- calendar ---------- */

.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 18px 20px 22px;
}

.cal .hd {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--dim);
  text-align: center;
  padding-bottom: 6px;
  text-transform: uppercase;
}

.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  border: 1px solid rgba(88, 118, 158, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 7px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.16s, transform 0.16s;
}

.cell:hover { border-color: rgba(125, 211, 252, 0.5); transform: translateY(-1px); }

.cell.empty { border: 0; }

.cell .d { font-size: 11px; color: var(--dim); }

.cell .a { font-size: 11.5px; color: var(--ink); }

.cell.today { border-color: rgba(125, 211, 252, 0.7); }

.cell.today .d { color: var(--accent); }

/* ---------- month switch ---------- */

.mswitch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.mswitch a {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--dim);
}

.mswitch a:hover { color: var(--ink); border-color: rgba(125, 211, 252, 0.45); }

/* ---------- form ---------- */

.field { margin-bottom: 16px; }

.field > label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 7px;
}

input[type="text"], input[type="password"], input[type="number"], input[type="date"] {
  width: 100%;
  background: rgba(6, 10, 16, 0.72);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  padding: 11px 13px;
  outline: none;
  transition: border-color 0.16s;
  font-variant-numeric: tabular-nums;
}

input:focus { border-color: rgba(125, 211, 252, 0.6); }

select {
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(6, 10, 16, 0.72);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238295ac' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 30px 9px 12px;
  outline: none;
  cursor: pointer;
}

select:focus { border-color: rgba(125, 211, 252, 0.6); }

html[data-theme="light"] select {
  color-scheme: light;
  background-color: #ffffff !important;
  color: var(--ink) !important;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2346566d' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

html[data-theme="light"] select:focus { border-color: rgba(13, 138, 201, 0.45); }

.amount-input {
  font-size: 32px !important;
  font-weight: 300;
  letter-spacing: -0.02em;
  padding: 8px 13px !important;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.16s;
  background: transparent;
  font-family: inherit;
}

.chip:hover { border-color: rgba(125, 211, 252, 0.4); }

.chip.on {
  color: var(--ink);
  border-color: rgba(125, 211, 252, 0.65);
  background: rgba(125, 211, 252, 0.08);
}

.chips.sub { margin-top: 9px; gap: 6px; padding-left: 2px; }
.chip.sub {
  padding: 4px 11px;
  font-size: 12px;
  border-radius: 8px;
  color: var(--dim);
}
.chip.sub.on {
  color: var(--ink);
  border-color: rgba(125, 211, 252, 0.45);
  background: rgba(125, 211, 252, 0.11);
}
.hint { font-size: 12px; color: var(--dim); padding: 5px 2px; }

.chip.add {
  padding: 4px 11px;
  color: var(--dim);
  border-style: dashed;
  font-size: 15px;
  line-height: 1;
  min-width: 32px;
  justify-content: center;
}
.chip.add:hover { color: var(--ink); border-color: rgba(125, 211, 252, 0.5); }
.chips.sub .chip.add { font-size: 13px; padding: 3px 9px; }

.chip-input {
  width: 96px;
  border: 1px solid rgba(125, 211, 252, 0.5);
  background: rgba(6, 10, 16, 0.72);
  border-radius: 999px;
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  padding: 5px 12px;
  outline: none;
}
.chip-input::placeholder { color: var(--dim); }

.actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; }

button.primary {
  border: 1px solid rgba(125, 211, 252, 0.6);
  background: rgba(125, 211, 252, 0.12);
  color: var(--ink);
  border-radius: 10px;
  padding: 11px 26px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.16s;
}

button.primary:hover { background: rgba(125, 211, 252, 0.2); }

button.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

button.ghost:hover { color: var(--ink); }

button.mini {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
}

button.mini:hover { color: var(--ink); border-color: rgba(125, 211, 252, 0.4); }

button.danger { color: #f0a0a0; border-color: rgba(248, 113, 113, 0.3); }

/* ---------- chart ---------- */

.bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 168px;
  padding: 22px 22px 0;
}

.bars .col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  height: 100%;
}

.bars .bar {
  width: 100%;
  max-width: 42px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, rgba(125, 211, 252, 0.85), rgba(56, 130, 190, 0.45));
  min-height: 2px;
}

.bars .cap {
  font-size: 10.5px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.axis {
  padding: 10px 22px 18px;
  border-top: 1px solid rgba(88, 118, 158, 0.12);
  font-size: 11.5px;
  color: var(--dim);
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

/* ---------- misc ---------- */

.empty-state {
  padding: 40px 22px;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}

.hidden { display: none !important; }

.foot {
  margin-top: 54px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--dim);
  display: flex;
  justify-content: space-between;
}

.edit-inline {
  display: grid;
  grid-template-columns: 136px 118px 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px 22px;
  background: rgba(8, 13, 20, 0.6);
  border-bottom: 1px solid rgba(88, 118, 158, 0.14);
}

.edit-inline input { font-size: 13px !important; padding: 7px 9px !important; }

.login-box {
  max-width: 320px;
  margin: 100px auto 0;
}

@media (max-width: 640px) {
  .wrap { padding: 0 16px 56px; }
  .hero { font-size: 36px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 9px; }
  .stat { padding: 12px 12px; }
  .stat .v { font-size: 18px; }
  .cat { grid-template-columns: 74px 1fr 78px; gap: 10px; padding: 10px 16px; }
  .row { grid-template-columns: 58px 1fr auto; padding: 11px 16px; }
  .row .what em { display: none; }
  .cal { gap: 4px; padding: 14px 12px 18px; }
  .cell { padding: 4px 5px; }
  .cell .a { font-size: 9.5px; }
  .cell .d { font-size: 10px; }
  .edit-inline { grid-template-columns: 1fr 1fr; }
  .top { gap: 12px; padding: 18px 0 20px; }
  .brand { font-size: 13px; }
  .top a.navlink { font-size: 12px; }
}

/* ---------- theme lamp ---------- */

.lamp {
  width: 32px;
  height: 32px;
  flex: none;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, background 0.18s, box-shadow 0.28s;
}

.lamp svg { width: 16px; height: 16px; display: block; }

.lamp:hover { color: var(--muted); border-color: rgba(125, 211, 252, 0.45); }

.lamp.on {
  color: #f4b740;
  border-color: rgba(244, 183, 64, 0.55);
  background: rgba(244, 183, 64, 0.14);
  box-shadow: 0 0 14px rgba(244, 183, 64, 0.35);
}

.lamp.on svg { filter: drop-shadow(0 0 3px rgba(244, 183, 64, 0.6)); }

/* ---------- light theme ---------- */

html[data-theme="light"] {
  --bg: #f1f5fb;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-2: rgba(255, 255, 255, 0.98);
  --line: rgba(20, 40, 72, 0.17);
  --ink: #0d1725;
  --muted: #46566d;
  --dim: #6e7c90;
  --accent: #0d8ac9;
  --warn: #d92d20;
  color-scheme: light;
}

html[data-theme="light"] body {
  background:
    radial-gradient(1100px 620px at 78% -8%, rgba(122, 178, 240, 0.3), transparent 62%),
    radial-gradient(880px 520px at 8% 12%, rgba(150, 200, 245, 0.24), transparent 58%),
    linear-gradient(180deg, #fdfefe, #eff4fb 60%, #e8eff8);
}

html[data-theme="light"] .panel,
html[data-theme="light"] .stat {
  box-shadow: 0 4px 16px rgba(20, 40, 72, 0.07);
}

html[data-theme="light"] .top a.navlink { color: var(--muted); }
html[data-theme="light"] .top a.navlink:hover { color: var(--ink); }

html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] input[type="number"],
html[data-theme="light"] input[type="date"] {
  background: #ffffff;
}

html[data-theme="light"] .track { background: rgba(20, 40, 72, 0.08); }

html[data-theme="light"] .edit-inline { background: rgba(20, 40, 72, 0.05); }

html[data-theme="light"] .cell { border-color: rgba(20, 40, 72, 0.15); }
html[data-theme="light"] .cell .d { color: var(--muted); }
html[data-theme="light"] .cal .hd { color: var(--muted); }

html[data-theme="light"] .bars .bar {
  background: linear-gradient(180deg, rgba(13, 138, 201, 0.8), rgba(13, 138, 201, 0.32));
}

html[data-theme="light"] input:focus,
html[data-theme="light"] .chip:hover,
html[data-theme="light"] .cell:hover,
html[data-theme="light"] .chip.add:hover { border-color: rgba(13, 138, 201, 0.45); }

html[data-theme="light"] .chip.on,
html[data-theme="light"] .cell.today { border-color: rgba(13, 138, 201, 0.55); }

html[data-theme="light"] .chip.on { background: rgba(13, 138, 201, 0.09); }
html[data-theme="light"] .chip.sub.on { background: rgba(13, 138, 201, 0.12); border-color: rgba(13, 138, 201, 0.4); }

html[data-theme="light"] .lamp:hover { border-color: rgba(13, 138, 201, 0.45); }
html[data-theme="light"] .lamp.on {
  color: #b8770a;
  border-color: rgba(184, 119, 10, 0.4);
  background: rgba(244, 183, 64, 0.22);
  box-shadow: 0 0 14px rgba(244, 183, 64, 0.4);
}

/* ---------- all records ---------- */
.dayblock { margin-bottom: 12px; }
.dayblock .row:last-child { border-bottom: 0; }
.dayhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 22px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  transition: color 0.18s;
}
.dayhead:hover { color: var(--ink); }
.dayhead .dhr { color: var(--dim); }
html[data-theme="light"] .dayhead { background: rgba(20, 40, 72, 0.04); }

/* ---------- day detail rows ---------- */
.drow { grid-template-columns: max-content 1fr auto; }
.drow .day { white-space: nowrap; font-size: 12px; }
