:root {
  --bg: #f3efe6;
  --bg-deep: #ebe4d6;
  --paper: #fffdf8;
  --paper-soft: #faf6ed;
  --ink: #223a30;
  --ink-soft: #385045;
  --muted: #7c847b;
  --muted-2: #9ba198;
  --line: #e4dccd;
  --line-strong: #d5cab6;
  --green: #2f6b4f;
  --green-light: #e2ece4;
  --green-wash: #edf3ee;
  --clay: #c46645;
  --clay-deep: #a74d31;
  --clay-soft: #f7e3d9;
  --gold: #bd9445;
  --gold-soft: #f4ead1;
  --blue: #5877a5;
  --blue-soft: #e7ebf3;
  --danger: #b54f3a;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --shadow: 0 20px 55px rgba(45, 52, 40, 0.075);
  --shadow-soft: 0 8px 25px rgba(45, 52, 40, 0.055);
  --font-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Songti SC", "STSong", "STZhongsong", "SimSun", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 6%, rgba(255, 252, 243, 0.95) 0, rgba(255, 252, 243, 0) 36%),
    radial-gradient(circle at 90% 12%, rgba(219, 230, 218, 0.66) 0, rgba(219, 230, 218, 0) 33%),
    linear-gradient(145deg, #f6f2e9 0%, var(--bg) 48%, #eee8dc 100%);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid #789985;
  outline-offset: 2px;
}

input:focus-visible {
  outline: 0;
}

a {
  color: inherit;
}

::selection {
  background: #d9e6db;
  color: var(--ink);
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
  z-index: 0;
}

.ambient-a {
  width: 360px;
  height: 360px;
  top: -170px;
  right: 14%;
  background: radial-gradient(circle, rgba(187, 209, 189, 0.4), rgba(187, 209, 189, 0));
}

.ambient-b {
  width: 420px;
  height: 420px;
  bottom: -230px;
  left: 8%;
  background: radial-gradient(circle, rgba(232, 201, 169, 0.28), rgba(232, 201, 169, 0));
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  width: 100%;
  max-width: 1560px;
  min-height: 100vh;
  margin: 0 auto;
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 28px 20px 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  text-align: left;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  flex: 0 0 45px;
  border-radius: 14px;
  color: #f8f0df;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    var(--ink);
  box-shadow: 0 8px 20px rgba(34, 58, 48, 0.2);
  font-family: var(--font-serif);
  font-size: 23px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-copy strong {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.brand-copy small {
  color: var(--muted-2);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 44px;
}

.nav-label {
  padding: 0 12px 10px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.75;
  opacity: 0.82;
}

.nav-item:hover {
  background: rgba(255, 253, 248, 0.66);
  transform: translateX(1px);
}

.nav-item.is-active {
  color: #f9f1e2;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(34, 58, 48, 0.16);
}

.nav-item.is-active svg {
  opacity: 1;
}

.nav-item.is-active::after {
  content: "";
  position: absolute;
  right: 13px;
  width: 5px;
  height: 5px;
  border-radius: 99px;
  background: #d8b77b;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-note {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid rgba(213, 202, 182, 0.72);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.52);
}

.sidebar-note svg {
  width: 17px;
  height: 17px;
  margin-bottom: 8px;
  color: var(--green);
}

.sidebar-note p {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

.sidebar-note strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.sidebar-version {
  padding: 8px 6px 0;
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.08em;
}

/* ---------- Main / topbar ---------- */

.main-column {
  min-width: 0;
  padding: 0 38px;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 106px;
  padding: 24px 0 20px;
}

.topbar-title {
  min-width: 0;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 16px;
  height: 1px;
  background: var(--line-strong);
}

.topbar h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(25px, 2.1vw, 32px);
  font-weight: 700;
  letter-spacing: 0.015em;
  line-height: 1.15;
}

.topbar-sub {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.period-picker {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.78);
  box-shadow: 0 5px 18px rgba(45, 52, 40, 0.035);
  backdrop-filter: blur(12px);
}

.period-picker select {
  height: 33px;
  padding: 0 22px 0 9px;
  border: 0;
  border-radius: 999px;
  outline: 0;
  background-color: transparent;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.period-picker select:hover {
  background-color: rgba(235, 240, 233, 0.7);
}

.period-step {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  transition: background 150ms ease, color 150ms ease;
}

.period-step:hover {
  color: var(--ink);
  background: var(--green-light);
}

.period-step svg {
  width: 15px;
  height: 15px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  color: #faf3e5;
  background: var(--ink);
  box-shadow: 0 8px 20px rgba(34, 58, 48, 0.16);
}

.btn-primary:hover {
  background: #2b4b3d;
  box-shadow: 0 10px 24px rgba(34, 58, 48, 0.22);
}

.btn-clay {
  color: #fff8f2;
  background: var(--clay);
  box-shadow: 0 8px 20px rgba(196, 102, 69, 0.2);
}

.btn-clay:hover {
  background: var(--clay-deep);
}

.btn-ghost {
  border-color: var(--line);
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.5);
}

.btn-ghost:hover {
  border-color: var(--line-strong);
  background: var(--paper);
}

.btn-soft {
  color: var(--green);
  background: var(--green-light);
}

.btn-soft:hover {
  background: #d5e5d9;
}

.btn-danger {
  color: #fff;
  background: var(--danger);
}

.btn-danger:hover {
  background: #993f2d;
}

.btn-sm {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 11px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
}

.link-button:hover {
  color: var(--green);
}

.link-button svg {
  width: 14px;
  height: 14px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  transition: color 150ms ease, background 150ms ease;
}

.icon-btn:hover {
  color: var(--clay);
  background: var(--clay-soft);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

/* ---------- View / cards ---------- */

.view-root {
  min-height: calc(100vh - 190px);
  padding-bottom: 42px;
  outline: 0;
}

.view-anim {
  animation: rise-in 380ms cubic-bezier(0.22, 0.75, 0.3, 1) both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 17px;
}

.metric {
  position: relative;
  min-height: 155px;
  padding: 20px 20px 17px;
  overflow: hidden;
  border: 1px solid rgba(226, 218, 202, 0.9);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.87);
  box-shadow: var(--shadow-soft);
}

.metric::after {
  content: "";
  position: absolute;
  width: 110px;
  height: 110px;
  right: -45px;
  bottom: -52px;
  border: 1px solid rgba(47, 107, 79, 0.09);
  border-radius: 99px;
  pointer-events: none;
}

.metric-dark {
  border-color: transparent;
  color: #f8f1e2;
  background:
    radial-gradient(circle at 100% 0%, rgba(216, 183, 123, 0.15), transparent 44%),
    linear-gradient(145deg, #28473a, #1d3229);
  box-shadow: 0 18px 40px rgba(31, 53, 42, 0.2);
}

.metric-dark::after {
  border-color: rgba(248, 241, 226, 0.1);
}

.metric-sand {
  border-color: #eadfc7;
  background:
    radial-gradient(circle at 100% 0%, rgba(189, 148, 69, 0.12), transparent 45%),
    linear-gradient(145deg, #f9f1de, #f3e8d1);
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.metric-dark .metric-label {
  color: #b9c9bd;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  color: var(--green);
  background: var(--green-light);
}

.metric-dark .metric-icon {
  color: #e5cfaa;
  background: rgba(255, 255, 255, 0.08);
}

.metric-icon svg {
  width: 15px;
  height: 15px;
}

.metric-value {
  margin-top: 16px;
  font-size: clamp(25px, 2.5vw, 34px);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.metric-value .currency {
  margin-right: 2px;
  font-size: 0.55em;
  font-weight: 500;
  letter-spacing: 0;
  vertical-align: 0.18em;
  opacity: 0.75;
}

.metric-dark .metric-value {
  color: #f6ddcb;
}

.metric-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 15px;
  color: var(--muted-2);
  font-size: 10px;
}

.metric-dark .metric-foot {
  color: #93aa9b;
}

.metric-foot strong,
.metric-foot-strong {
  color: var(--ink-soft);
  font-weight: 650;
}

.text-clay {
  color: var(--clay) !important;
}

.metric-dark .metric-foot strong {
  color: #e7d4b3;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 99px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.delta-up {
  color: #a95438;
  background: #f8e5da;
}

.delta-down {
  color: #2f6b4f;
  background: #e3efe6;
}

.delta-flat {
  color: var(--muted);
  background: rgba(120, 132, 120, 0.1);
}

.delta-good {
  color: #2f6b4f;
  background: #e3efe6;
}

.delta-bad {
  color: #a95438;
  background: #f8e5da;
}

.metric-dark .delta-up,
.metric-dark .delta-bad {
  color: #ffd9c8;
  background: rgba(196, 102, 69, 0.3);
}

.metric-dark .delta-down,
.metric-dark .delta-good {
  color: #cfe8d7;
  background: rgba(114, 176, 139, 0.22);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  gap: 17px;
}

svg {
  flex: 0 0 auto;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-7 {
  grid-column: span 7;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

.card {
  min-width: 0;
  padding: 22px;
  border: 1px solid rgba(226, 218, 202, 0.92);
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 248, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.card-head h2 {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.card-head .kicker {
  display: block;
  color: var(--muted-2);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.19em;
}

.card-head-side {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}

.card-head .meta {
  color: var(--muted);
  font-size: 10.5px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend i {
  width: 6px;
  height: 6px;
  border-radius: 99px;
}

.legend .expense {
  background: var(--clay);
}

.legend .income {
  background: var(--green);
}

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

.trend-card {
  grid-column: span 8;
}

.category-card {
  grid-column: span 4;
}

.chart-wrap {
  position: relative;
  padding-top: 4px;
}

.chart-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted-2);
  font-size: 9.5px;
}

.chart-topline strong {
  color: var(--ink-soft);
  font-weight: 650;
}

.bar-chart {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 2px;
  height: 166px;
  padding: 9px 0 0;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(120, 130, 120, 0.075) 0,
    rgba(120, 130, 120, 0.075) 1px,
    transparent 1px,
    transparent 25%
  );
}

.bar-col {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  height: 100%;
  min-width: 0;
  padding: 0 1px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  transition: background 150ms ease;
}

.bar-col:hover {
  background: rgba(47, 107, 79, 0.045);
}

.bar-col.is-selected {
  background: linear-gradient(to top, rgba(47, 107, 79, 0.07), transparent);
}

.bar-pair {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 143px;
}

.bar {
  display: block;
  width: min(9px, 38%);
  min-height: 2px;
  border-radius: 4px 4px 2px 2px;
  transition: height 420ms cubic-bezier(0.2, 0.7, 0.2, 1), opacity 150ms ease;
}

.bar-expense {
  background: linear-gradient(to top, #b95839, #d88a6d);
}

.bar-income {
  background: linear-gradient(to top, #2f6b4f, #70a285);
}

.bar-col:hover .bar {
  opacity: 0.82;
}

.bar-label {
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar-col.is-selected .bar-label {
  color: var(--ink);
  font-weight: 700;
}

.bar-col .bar-value {
  position: absolute;
  top: -3px;
  left: 50%;
  z-index: 2;
  display: none;
  padding: 3px 6px;
  border-radius: 6px;
  color: #f9f1e4;
  background: var(--ink);
  font-size: 9px;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.bar-col:hover .bar-value {
  display: block;
}

.chart-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted-2);
  font-size: 9.5px;
}

.chart-note svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.chart-note b {
  color: var(--clay);
  font-weight: 650;
}

/* ---------- Category donut ---------- */

.donut-area {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1px 0 17px;
}

.donut {
  position: relative;
  display: grid;
  place-items: center;
  width: 162px;
  height: 162px;
  border-radius: 999px;
  background: conic-gradient(#e9e2d4 0 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  transform: rotate(-90deg);
}

.donut::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: inherit;
  background: var(--paper);
  box-shadow: 0 0 0 1px rgba(226, 218, 202, 0.7);
}

.donut-hole {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transform: rotate(90deg);
  text-align: center;
}

.donut-hole small {
  color: var(--muted-2);
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

.donut-hole strong {
  max-width: 105px;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.donut-hole em {
  color: var(--muted);
  font-size: 8px;
  font-style: normal;
}

.cat-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.cat-row {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.cat-row:hover .cat-name {
  color: var(--green);
}

.cat-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
}

.cat-body {
  min-width: 0;
}

.cat-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.cat-name {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  transition: color 150ms ease;
}

.cat-pct {
  color: var(--muted-2);
  font-size: 9px;
}

.cat-track {
  display: block;
  height: 3px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: #eee9df;
}

.cat-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.cat-amount {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Recent list ---------- */

.recent-card {
  grid-column: span 7;
}

.payment-card {
  grid-column: span 5;
}

.tx-list {
  display: flex;
  flex-direction: column;
}

.tx-row {
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(228, 220, 205, 0.66);
}

.tx-row:first-child {
  padding-top: 0;
}

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

.cat-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--cat) 16%, transparent);
  border-radius: 11px;
  color: var(--cat);
  background: color-mix(in srgb, var(--cat) 9%, #fffdf8);
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
}

.tx-main {
  min-width: 0;
}

.tx-main strong {
  display: block;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-main span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-side {
  text-align: right;
}

.tx-amount {
  display: block;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tx-amount.expense {
  color: var(--ink);
}

.tx-amount.income {
  color: var(--green);
}

.tx-amount.muted {
  color: var(--muted-2);
  text-decoration: line-through;
  text-decoration-color: rgba(124, 132, 123, 0.4);
}

.tx-side time {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.section-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 180px;
  padding: 25px;
  border: 1px dashed var(--line);
  border-radius: 15px;
  color: var(--muted);
  background: rgba(250, 246, 237, 0.5);
  text-align: center;
}

.section-empty svg {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  color: var(--muted-2);
}

.section-empty strong {
  color: var(--ink-soft);
  font-size: 12px;
}

.section-empty p {
  max-width: 260px;
  margin: 0;
  font-size: 10px;
  line-height: 1.6;
}

.section-empty .btn {
  margin-top: 5px;
}

/* ---------- Payment card ---------- */

.pay-summary {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 1px 0 17px;
  padding: 13px 14px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(237, 243, 238, 0.9), rgba(247, 243, 234, 0.65));
}

.pay-summary span {
  color: var(--muted);
  font-size: 10px;
}

.pay-summary strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.pay-summary .sub {
  color: var(--muted-2);
  font-size: 9px;
  text-align: right;
  line-height: 1.55;
}

.pay-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pay-row {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.pay-icon {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--green);
  background: var(--paper-soft);
}

.pay-icon svg {
  width: 14px;
  height: 14px;
}

.pay-main {
  min-width: 0;
}

.pay-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.pay-label span {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pay-label em {
  color: var(--muted-2);
  font-size: 9px;
  font-style: normal;
  white-space: nowrap;
}

.pay-track {
  display: block;
  height: 3px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: #eee8dc;
}

.pay-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #486f5a, #8bad95);
}

.pay-amount {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card-hint {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.6;
}

/* ---------- Empty welcome ---------- */

.welcome-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
  padding: 25px 27px;
  overflow: hidden;
  border: 1px solid #dfd5c2;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 94% 10%, rgba(194, 216, 196, 0.54), transparent 35%),
    linear-gradient(130deg, #fffdf7, #f6eddc);
  box-shadow: var(--shadow);
}

.welcome-card::after {
  content: "拾";
  position: absolute;
  right: 165px;
  bottom: -52px;
  color: rgba(34, 58, 48, 0.045);
  font-family: var(--font-serif);
  font-size: 170px;
  line-height: 1;
  pointer-events: none;
}

.welcome-card h2 {
  margin: 4px 0 7px;
  font-family: var(--font-serif);
  font-size: 23px;
  font-weight: 700;
}

.welcome-card p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}

.welcome-card .actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 9px;
}

/* ---------- Details ---------- */

.details-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

.mini-stat {
  padding: 16px 18px;
  border: 1px solid rgba(226, 218, 202, 0.92);
  border-radius: 15px;
  background: rgba(255, 253, 248, 0.76);
}

.mini-stat span {
  color: var(--muted);
  font-size: 10px;
}

.mini-stat strong {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.mini-stat strong.clay {
  color: var(--clay);
}

.mini-stat strong.green {
  color: var(--green);
}

.filter-card {
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 17px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.search-field {
  position: relative;
  flex: 1 1 250px;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 15px;
  height: 15px;
  color: var(--muted-2);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 35px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: rgba(255, 253, 248, 0.85);
  font-size: 11.5px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search-field input::placeholder {
  color: var(--muted-2);
}

.search-field input:focus {
  border-color: #9db6a5;
  box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.08);
}

.filter-select {
  height: 38px;
  max-width: 145px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  color: var(--ink-soft);
  background-color: rgba(255, 253, 248, 0.8);
  font-size: 10.5px;
  cursor: pointer;
}

.filter-select:focus {
  border-color: #9db6a5;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.table-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.table-header .count {
  margin-left: 7px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 400;
}

.table-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.tx-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 11px;
}

.tx-table th {
  padding: 11px 13px;
  color: var(--muted-2);
  background: rgba(247, 243, 234, 0.68);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  white-space: nowrap;
}

.tx-table th.num,
.tx-table td.num {
  text-align: right;
}

.tx-table td {
  padding: 12px 13px;
  border-top: 1px solid rgba(228, 220, 205, 0.66);
  color: var(--ink-soft);
  vertical-align: middle;
}

.tx-table tbody tr {
  transition: background 120ms ease;
}

.tx-table tbody tr:hover {
  background: rgba(241, 246, 240, 0.54);
}

.date-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.date-cell strong {
  display: block;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
}

.date-cell span {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 9px;
}

.merchant-cell {
  min-width: 150px;
  max-width: 220px;
}

.merchant-cell strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merchant-cell span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
}

.source-wechat {
  color: #25704c;
  background: #e6f1e9;
}

.source-alipay {
  color: #346b9f;
  background: #e8f0f8;
}

.source-other {
  color: #76654b;
  background: #f2ece0;
}

.source-manual {
  color: #7b5c25;
  background: #f7edd6;
}

.cat-select {
  max-width: 92px;
  height: 28px;
  padding: 0 18px 0 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  outline: 0;
  color: var(--ink-soft);
  background-color: transparent;
  font-size: 10px;
  cursor: pointer;
}

.cat-select:hover,
.cat-select:focus {
  border-color: var(--line);
  background-color: var(--paper);
}

.pay-cell {
  max-width: 135px;
  overflow: hidden;
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pay-cell .card-tail {
  display: inline-block;
  margin-left: 3px;
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--green);
  background: var(--green-light);
  font-size: 8px;
  font-weight: 700;
  vertical-align: 1px;
}

.status-cell {
  white-space: nowrap;
}

.status-pill {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--muted);
  background: #f0ece3;
  font-size: 8.5px;
}

.status-pill.refund {
  color: #9b5a37;
  background: #f7e8dc;
}

.status-pill.neutral {
  color: #7c7e77;
  background: #eceae4;
}

.amount-cell {
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount-cell.expense {
  color: var(--ink);
}

.amount-cell.income {
  color: var(--green);
}

.amount-cell.neutral {
  color: var(--muted-2);
}

.amount-cell small {
  display: block;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 8.5px;
  font-weight: 400;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  width: 64px;
  padding-left: 0 !important;
  padding-right: 10px !important;
}

.row-actions .icon-btn {
  opacity: 0;
}

.row-actions .icon-btn.edit:hover {
  color: var(--green);
  background: var(--green-light);
}

.tx-table tr:hover .row-actions .icon-btn,
.row-actions .icon-btn:focus {
  opacity: 1;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.pagination .page-info {
  color: var(--muted-2);
  font-size: 9.5px;
}

.page-buttons {
  display: flex;
  align-items: center;
  gap: 3px;
}

.page-btn {
  display: grid;
  place-items: center;
  min-width: 27px;
  height: 27px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
}

.page-btn:hover {
  background: var(--green-light);
}

.page-btn.is-active {
  color: #f8f1e4;
  background: var(--ink);
}

.page-btn:disabled {
  opacity: 0.3;
}

/* ---------- Annual ---------- */

.annual-metrics {
  margin-bottom: 17px;
}

.annual-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  align-items: start;
  gap: 17px;
  margin-bottom: 17px;
}

.month-table {
  padding: 0;
  overflow: hidden;
}

.month-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 19px 21px 14px;
}

.month-table-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.month-table-head span {
  color: var(--muted-2);
  font-size: 9.5px;
}

.month-rows {
  display: flex;
  flex-direction: column;
}

.month-row {
  display: grid;
  grid-template-columns: 39px minmax(90px, 1fr) 94px 82px 74px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 21px;
  border: 0;
  border-top: 1px solid rgba(228, 220, 205, 0.55);
  background: transparent;
  text-align: left;
  transition: background 120ms ease;
}

.month-row:hover {
  background: rgba(241, 246, 240, 0.54);
}

.month-row.is-current {
  background: rgba(241, 246, 240, 0.54);
}

.month-name {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
  white-space: nowrap;
}

.month-bar-wrap {
  min-width: 0;
}

.month-bar-track {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: #eee9df;
}

.month-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c46645, #dda286);
}

.month-num {
  color: var(--ink-soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.month-num.expense {
  color: var(--clay);
  font-weight: 650;
}

.month-num.income {
  color: var(--green);
  font-weight: 650;
}

.month-num.neutral {
  color: var(--muted-2);
}

.month-total {
  display: grid;
  grid-template-columns: 39px minmax(90px, 1fr) 94px 82px 74px;
  align-items: center;
  gap: 10px;
  padding: 12px 21px;
  border-top: 1px solid var(--line-strong);
  background: rgba(247, 243, 234, 0.7);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 700;
}

.month-total .month-num {
  font-size: 11px;
  font-weight: 750;
}

.annual-cat-card {
  display: flex;
  flex-direction: column;
  align-self: stretch;
}

.annual-cat-card .bar-list {
  flex: 1;
}

.cat-foot {
  margin-top: 19px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.cat-foot div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.cat-foot span {
  color: var(--muted);
  font-size: 10px;
}

.cat-foot strong {
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.cat-foot p {
  margin: 8px 0 0;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.6;
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bar-list-row {
  display: grid;
  grid-template-columns: 65px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.bar-list-name {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-list-name i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 99px;
  vertical-align: 1px;
}

.bar-list-track {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #eee9df;
}

.bar-list-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.bar-list-amount {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.annual-bottom {
  align-items: start;
}

.source-card {
  grid-column: span 5;
}

.annual-payment-card {
  grid-column: span 7;
}

.split-bar {
  display: flex;
  height: 10px;
  margin: 2px 0 17px;
  overflow: hidden;
  border-radius: 99px;
  background: #eee9df;
}

.split-bar span {
  height: 100%;
}

.source-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.source-item {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
}

.source-item i {
  width: 7px;
  height: 7px;
  border-radius: 99px;
}

.source-item strong {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
}

.source-item span {
  color: var(--muted-2);
  font-size: 9px;
}

.source-item em {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.annual-insights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px dashed var(--line);
}

.insight {
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--paper-soft);
}

.insight span {
  display: block;
  color: var(--muted-2);
  font-size: 8.5px;
}

.insight strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Import ---------- */

.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 17px;
  margin-bottom: 17px;
}

.import-card {
  padding: 17px;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 318px;
  padding: 35px 24px;
  border: 1.5px dashed #c9bda7;
  border-radius: 19px;
  background:
    radial-gradient(circle at 50% 0%, rgba(224, 236, 225, 0.5), transparent 46%),
    rgba(250, 247, 239, 0.58);
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.dropzone:hover,
.dropzone.is-drag {
  border-color: var(--green);
  background:
    radial-gradient(circle at 50% 0%, rgba(224, 236, 225, 0.85), transparent 50%),
    rgba(248, 246, 237, 0.88);
}

.dropzone.is-drag {
  transform: scale(1.008);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.dropzone label {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.upload-orb {
  display: grid;
  place-items: center;
  width: 65px;
  height: 65px;
  margin-bottom: 18px;
  border: 1px solid #dce6dd;
  border-radius: 20px;
  color: var(--green);
  background: linear-gradient(145deg, #f9fcf8, #e5eee5);
  box-shadow: 0 12px 30px rgba(47, 107, 79, 0.11);
}

.upload-orb svg {
  width: 26px;
  height: 26px;
  stroke-width: 1.6;
}

.dropzone h2 {
  margin: 0 0 7px;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
}

.dropzone p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.dropzone .btn {
  margin-top: 17px;
}

.dropzone small {
  margin-top: 14px;
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.dropzone.is-busy {
  pointer-events: none;
  opacity: 0.72;
}

.loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 99px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.help-card h2 {
  margin: 5px 0 6px;
  font-size: 15px;
}

.help-card > p {
  margin: 0 0 17px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.step {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green);
  background: var(--paper-soft);
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
  position: relative;
  top: -4px;
}

.step strong {
  display: block;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
}

.step-copy span {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 9.5px;
  line-height: 1.55;
}

.help-note {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid #eadfc7;
  border-radius: 11px;
  color: #7f6836;
  background: #fbf4e3;
  font-size: 9px;
  line-height: 1.65;
}

.help-note strong {
  font-weight: 700;
}

.import-preview {
  margin-top: 17px;
}

.preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 15px;
}

.preview-head h2 {
  margin: 3px 0 0;
  font-size: 16px;
}

.preview-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-soft);
  font-size: 9.5px;
}

.file-chip svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
}

.file-chip .file-name {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip .ok {
  color: var(--green);
}

.file-chip .error {
  color: var(--danger);
}

.import-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.stat-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 9px;
}

.stat-pill strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-pill.good {
  background: var(--green-light);
}

.stat-pill.warn {
  background: var(--gold-soft);
}

.stat-pill.bad {
  background: var(--clay-soft);
}

.preview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 15px;
  margin-top: 15px;
  border-top: 1px solid var(--line);
}

.preview-actions .hint {
  flex: 1;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.55;
}

.import-errors {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #edc9b9;
  border-radius: 9px;
  color: #8e432d;
  background: #fbebe3;
  font-size: 9.5px;
  line-height: 1.6;
}

.import-errors strong {
  font-weight: 700;
}

.import-log {
  margin-top: 17px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 253, 248, 0.62);
}

.import-log h3 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
}

.import-log p {
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.7;
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* ---------- Toast / modal ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  max-width: min(86vw, 420px);
  padding: 11px 17px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  color: #faf4e7;
  background: rgba(31, 51, 42, 0.96);
  box-shadow: 0 16px 40px rgba(20, 32, 25, 0.28);
  font-size: 11px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 19px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(30, 43, 35, 0.24);
}

.modal::backdrop {
  background: rgba(29, 41, 34, 0.38);
  backdrop-filter: blur(3px);
}

.modal form {
  padding: 23px;
}

.modal-kicker {
  color: var(--muted-2);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.18em;
}

.modal h3 {
  margin: 7px 0 8px;
  font-family: var(--font-serif);
  font-size: 21px;
}

.modal p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

/* ---------- Manual entry ---------- */

.entry-modal {
  width: min(650px, calc(100vw - 32px));
  max-height: calc(100vh - 34px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 90px rgba(30, 43, 35, 0.27);
}

.entry-modal::backdrop {
  background: rgba(29, 41, 34, 0.44);
  backdrop-filter: blur(4px);
}

.entry-modal[open] {
  animation: modal-rise 220ms cubic-bezier(0.22, 0.75, 0.3, 1) both;
}

@keyframes modal-rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.entry-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: calc(100vh - 36px);
  padding: 24px;
  overflow-y: auto;
}

.entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.entry-head h3 {
  margin: 5px 0 5px;
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.entry-head p {
  max-width: 470px;
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

.entry-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0 0 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--paper-soft);
  font-size: 23px;
  font-weight: 300;
  line-height: 1;
}

.entry-close:hover {
  color: var(--ink);
  background: var(--green-light);
}

.entry-dir {
  display: inline-flex;
  align-self: flex-start;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
}

.entry-dir button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  height: 33px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  transition: color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

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

.entry-dir button.is-active {
  color: #faf3e5;
  background: var(--ink);
  box-shadow: 0 5px 14px rgba(34, 58, 48, 0.16);
}

.entry-dir button[data-entry-direction="income"].is-active {
  background: var(--green);
}

.entry-amount-row {
  display: grid;
  grid-template-columns: 1.35fr 1fr 0.8fr;
  gap: 10px;
}

.entry-amount-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.amount-input {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-soft);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.amount-input:focus-within {
  border-color: #96b19f;
  box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.07);
}

.amount-input i {
  margin-right: 7px;
  color: var(--muted);
  font-size: 18px;
  font-style: normal;
  font-weight: 500;
}

.amount-input input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.amount-input input::placeholder {
  color: var(--muted-2);
  opacity: 0.8;
}

.amount-input input::-webkit-outer-spin-button,
.amount-input input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.07em;
}

.field input,
.field select {
  width: 100%;
  height: 40px;
  min-width: 0;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  color: var(--ink-soft);
  background: rgba(250, 246, 237, 0.72);
  font-size: 11.5px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.field select {
  padding-right: 26px;
  cursor: pointer;
}

.field input::placeholder {
  color: var(--muted-2);
}

.field input:focus,
.field select:focus {
  border-color: #96b19f;
  background: var(--paper);
  box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.07);
}

.field input[type="date"],
.field input[type="time"] {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px 14px;
}

.field-wide {
  grid-column: span 2;
}

.entry-bank {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.7fr;
  gap: 10px;
  padding: 13px;
  border: 1px solid #dce7de;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(239, 246, 240, 0.82), rgba(250, 247, 239, 0.68));
}

.entry-bank[hidden] {
  display: none;
}

.entry-bank .field input,
.entry-bank .field select {
  background: rgba(255, 253, 248, 0.86);
}

.form-error {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid #edc9b9;
  border-radius: 9px;
  color: #8e432d;
  background: #fbebe3;
  font-size: 10px;
  line-height: 1.5;
}

.entry-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.entry-hint {
  margin-right: auto;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.5;
}

.noscript {
  position: fixed;
  inset: auto 20px 20px;
  z-index: 999;
  padding: 14px;
  border-radius: 10px;
  color: #fff;
  background: var(--danger);
  text-align: center;
  font-size: 13px;
}

/* ---------- Footer ---------- */

.app-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 17px 2px 24px;
  border-top: 1px solid rgba(213, 202, 182, 0.58);
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.02em;
}

.app-foot b {
  margin: 0 4px;
  color: var(--line-strong);
  font-weight: 400;
}

/* ---------- Responsive ---------- */

@media (max-width: 1240px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trend-card,
  .category-card,
  .recent-card,
  .payment-card {
    grid-column: span 12;
  }

  .trend-card,
  .recent-card {
    order: 1;
  }

  .category-card,
  .payment-card {
    order: 2;
  }

  .cat-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 20px;
  }

  .annual-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .main-column {
    padding: 0 24px;
  }

  .sidebar {
    padding-left: 15px;
    padding-right: 15px;
  }

  .import-layout {
    grid-template-columns: 1fr;
  }

  .help-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 25px;
  }

  .help-card .card-head,
  .help-card .help-note {
    grid-column: span 2;
  }

  .source-card,
  .annual-payment-card {
    grid-column: span 12;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    height: auto;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(213, 202, 182, 0.55);
    background: rgba(246, 242, 233, 0.9);
    backdrop-filter: blur(18px);
  }

  .brand {
    width: auto;
    flex: 0 0 auto;
    padding: 0;
  }

  .brand-mark {
    width: 35px;
    height: 35px;
    flex-basis: 35px;
    border-radius: 10px;
    font-size: 18px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .brand-copy small,
  .nav-label,
  .sidebar-note,
  .sidebar-version,
  .sidebar-spacer {
    display: none;
  }

  .nav {
    flex-direction: row;
    gap: 2px;
    min-width: 0;
    margin: 0 0 0 auto;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    width: auto;
    min-height: 35px;
    padding: 8px 9px;
    border-radius: 9px;
    font-size: 10.5px;
    white-space: nowrap;
  }

  .nav-item svg {
    width: 15px;
    height: 15px;
  }

  .nav-item.is-active::after {
    display: none;
  }

  .main-column {
    padding: 0 17px;
  }

  .topbar {
    min-height: 88px;
    padding: 17px 0 14px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .topbar-sub {
    font-size: 10.5px;
  }

  .topbar-actions .btn-primary,
  .topbar-actions .btn-manual {
    width: 38px;
    min-width: 38px;
    padding: 0;
    border-radius: 10px;
    font-size: 0;
    gap: 0;
  }

  .topbar-actions .btn-primary svg,
  .topbar-actions .btn-manual svg {
    width: 17px;
    height: 17px;
  }

  .app-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

@media (max-width: 680px) {
  .sidebar {
    flex-wrap: wrap;
  }

  .nav {
    width: 100%;
    margin: 8px 0 0;
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .period-picker {
    flex: 1;
    justify-content: space-between;
  }

  .period-picker select {
    flex: 1;
  }

  .metrics {
    gap: 10px;
  }

  .metric {
    min-height: 137px;
    padding: 16px;
  }

  .metric-value {
    margin-top: 13px;
    font-size: clamp(21px, 6vw, 27px);
  }

  .card {
    padding: 17px;
    border-radius: 18px;
  }

  .cat-list {
    display: flex;
  }

  .chart-wrap {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .bar-chart {
    min-width: 0;
  }

  .bar {
    width: min(8px, 34%);
  }

  .bar-pair {
    gap: 2px;
  }

  .bar-label {
    font-size: 8px;
  }

  .annual-layout {
    gap: 12px;
  }

  .month-row,
  .month-total {
    grid-template-columns: 33px minmax(70px, 1fr) 77px 63px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .month-row .month-num.neutral,
  .month-total .month-num.neutral {
    display: none;
  }

  .welcome-card {
    grid-template-columns: 1fr;
    padding: 21px;
  }

  .welcome-card .actions {
    flex-wrap: wrap;
  }

  .details-summary {
    gap: 8px;
  }

  .mini-stat {
    padding: 12px;
  }

  .mini-stat strong {
    font-size: 16px;
  }

  .filter-card {
    padding: 10px;
  }

  .filter-select {
    flex: 1 1 30%;
    max-width: none;
  }

  .search-field {
    flex-basis: 100%;
  }

  .pagination {
    flex-direction: column;
    align-items: flex-start;
  }

  .help-card {
    display: block;
  }

  .help-card .help-note {
    margin-top: 16px;
  }

  .preview-head {
    flex-direction: column;
  }

  .preview-actions {
    flex-wrap: wrap;
  }

  .preview-actions .hint {
    flex-basis: 100%;
  }

  .annual-insights {
    grid-template-columns: 1fr;
  }

  .entry-modal {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
    border-radius: 19px;
  }

  .entry-form {
    gap: 13px;
    max-height: calc(100vh - 20px);
    padding: 18px;
  }

  .entry-head h3 {
    font-size: 22px;
  }

  .entry-head p {
    font-size: 10px;
  }

  .entry-amount-row {
    grid-template-columns: 1fr 1fr;
  }

  .entry-amount-field {
    grid-column: span 2;
  }

  .entry-grid {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .field-wide {
    grid-column: auto;
  }

  .entry-bank {
    grid-template-columns: 1fr 1fr;
  }

  .entry-bank .field:first-child {
    grid-column: span 2;
  }

  .entry-actions {
    flex-wrap: wrap;
  }

  .entry-hint {
    flex-basis: 100%;
    margin-right: 0;
  }

  .app-foot {
    padding-bottom: 18px;
  }
}

@media (max-width: 380px) {
  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  .period-picker {
    flex: 1 1 100%;
  }

  .nav {
    gap: 2px;
  }

  .nav-item {
    gap: 6px;
    padding: 8px 7px;
    font-size: 10px;
  }

  .nav-item svg {
    width: 14px;
    height: 14px;
  }
}

@media (hover: none) {
  .row-actions .icon-btn {
    opacity: 1;
  }
}

@media (max-width: 440px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 126px;
  }

  .metric-value {
    font-size: 28px;
  }

  .details-summary {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
