:root {
  --paper: #f2efe6;
  --paper-deep: #e9e3d6;
  --card: #fbf9f3;
  --card-strong: #fffdf8;
  --ink: #1d2b24;
  --ink-soft: #526058;
  --ink-muted: #8a918b;
  --line: rgba(31, 48, 39, 0.11);
  --line-strong: rgba(31, 48, 39, 0.19);
  --green: #255943;
  --green-bright: #2e7154;
  --green-deep: #173d2e;
  --mint: #dce9df;
  --coral: #dd6b4f;
  --coral-soft: #f5ded7;
  --gold: #c99a39;
  --gold-soft: #f2e7ca;
  --blue: #507f92;
  --blue-soft: #dce9ed;
  --shadow-sm: 0 8px 24px rgba(28, 45, 36, 0.06);
  --shadow-md: 0 18px 48px rgba(28, 45, 36, 0.09);
  --shadow-lg: 0 32px 90px rgba(20, 37, 28, 0.18);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 13px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-serif: "Songti SC", "STSong", "Iowan Old Style", "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 10% 5%, rgba(221, 107, 79, 0.08), transparent 25%),
    radial-gradient(circle at 90% 10%, rgba(37, 89, 67, 0.09), transparent 24%),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(46, 113, 84, 0.25);
  outline-offset: 2px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

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

.ambient-one {
  width: 320px;
  height: 320px;
  top: 110px;
  left: -190px;
  border: 1px solid rgba(37, 89, 67, 0.14);
  box-shadow: 0 0 0 46px rgba(37, 89, 67, 0.025), 0 0 0 92px rgba(37, 89, 67, 0.018);
}

.ambient-two {
  width: 230px;
  height: 230px;
  right: -120px;
  bottom: 80px;
  border: 1px solid rgba(221, 107, 79, 0.14);
  box-shadow: 0 0 0 36px rgba(221, 107, 79, 0.025), 0 0 0 72px rgba(221, 107, 79, 0.018);
}

.page-shell {
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
  padding: 34px 0 118px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 47px;
  height: 47px;
  border-radius: 15px 15px 15px 5px;
  background: var(--green);
  color: #f7f1e5;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 9px 20px rgba(37, 89, 67, 0.18);
  transform: rotate(-3deg);
}

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

.brand-copy strong {
  font-family: var(--font-serif);
  font-size: 25px;
  letter-spacing: 0.07em;
  line-height: 1.15;
}

.brand-copy small {
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.11em;
}

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

.primary-button,
.secondary-button,
.quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 13px;
  border: 1px solid transparent;
  padding: 0 17px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button {
  background: var(--green);
  color: #fffdf7;
  box-shadow: 0 9px 22px rgba(37, 89, 67, 0.18);
}

.primary-button:hover {
  background: var(--green-deep);
  box-shadow: 0 12px 26px rgba(37, 89, 67, 0.23);
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(0);
}

.secondary-button {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
}

.secondary-button:hover,
.quiet-button:hover {
  background: rgba(37, 89, 67, 0.065);
  border-color: rgba(37, 89, 67, 0.2);
}

.quiet-button {
  border-color: var(--line);
  background: rgba(255, 253, 248, 0.62);
  color: var(--ink-soft);
  box-shadow: 0 4px 14px rgba(28, 45, 36, 0.025);
}

.top-add-button {
  min-width: 108px;
}

.data-wrap {
  position: relative;
}

.data-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 10px);
  right: 0;
  width: 254px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  animation: menu-in 150ms ease both;
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-5px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.data-menu-label {
  padding: 8px 10px 6px;
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.data-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 39px;
  border: 0;
  border-radius: 10px;
  padding: 0 10px;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
  font-size: 13px;
  cursor: pointer;
}

.data-menu button:hover {
  background: rgba(37, 89, 67, 0.07);
  color: var(--ink);
}

.data-menu .icon {
  width: 17px;
  height: 17px;
}

.data-menu-separator {
  height: 1px;
  margin: 6px 8px;
  background: var(--line);
}

.data-menu .danger-item {
  color: #b34e3a;
}

.data-menu .danger-item:hover {
  background: rgba(221, 107, 79, 0.09);
}

.week-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  animation: rise-in 460ms ease both;
}

.eyebrow,
.panel-kicker,
.modal-kicker {
  color: var(--green-bright);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.week-range-line {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 3px;
}

.week-range-line h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(30px, 3.8vw, 46px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.week-chip {
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--mint);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.week-chip.is-hidden {
  display: none;
}

.week-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
}

.round-button,
.today-button {
  height: 39px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.68);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.round-button:hover,
.today-button:hover {
  border-color: var(--line-strong);
  background: var(--card-strong);
  transform: translateY(-1px);
}

.round-button {
  display: grid;
  place-items: center;
  width: 39px;
  padding: 0;
  border-radius: 50%;
}

.today-button {
  border-radius: 999px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 600;
}

.today-button:disabled {
  cursor: default;
  opacity: 0.46;
  transform: none;
}

.today-button:disabled:hover {
  border-color: var(--line);
  background: rgba(255, 253, 248, 0.68);
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr);
  gap: 22px;
  margin-bottom: 22px;
  animation: rise-in 520ms 50ms ease both;
}

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

.budget-card {
  position: relative;
  overflow: hidden;
  min-height: 306px;
  border-radius: var(--radius-lg);
  padding: 30px 32px 28px;
  background:
    radial-gradient(circle at 85% 0%, rgba(101, 164, 126, 0.29), transparent 39%),
    radial-gradient(circle at 0% 100%, rgba(255, 255, 255, 0.06), transparent 32%),
    var(--green-deep);
  color: #f5f1e7;
  box-shadow: 0 24px 56px rgba(23, 61, 46, 0.22);
  isolation: isolate;
}

.budget-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 300px;
  height: 300px;
  right: -130px;
  bottom: -210px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 42px rgba(255, 255, 255, 0.025), 0 0 0 84px rgba(255, 255, 255, 0.018);
}

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

.budget-card-head p {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  letter-spacing: 0.01em;
}

.budget-card-head span {
  display: inline-block;
  margin-top: 3px;
  color: rgba(245, 241, 231, 0.61);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.budget-edit-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.065);
  color: rgba(255, 253, 247, 0.81);
  font-size: 11px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.budget-edit-button:hover {
  border-color: rgba(255, 255, 255, 0.31);
  background: rgba(255, 255, 255, 0.12);
}

.budget-edit-button .icon {
  width: 14px;
  height: 14px;
}

.budget-card-body {
  display: flex;
  align-items: center;
  gap: clamp(24px, 4vw, 48px);
  margin-top: 22px;
}

.budget-ring {
  --ring-color: #9fcdb0;
  --ring-angle: 0deg;
  position: relative;
  display: grid;
  place-items: center;
  width: 174px;
  height: 174px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) var(--ring-angle), rgba(255, 255, 255, 0.11) 0);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 14px 40px rgba(0, 0, 0, 0.12);
  transition: background 300ms ease;
}

.budget-ring::after {
  content: "";
  position: absolute;
  width: 146px;
  height: 146px;
  border-radius: 50%;
  background: var(--green-deep);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.budget-ring-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.budget-ring-inner span {
  color: rgba(245, 241, 231, 0.56);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.budget-ring-inner strong {
  margin: 2px 0 1px;
  color: #fffdf6;
  font-family: var(--font-serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.budget-ring-inner small {
  color: rgba(245, 241, 231, 0.55);
  font-size: 10px;
}

.budget-summary {
  min-width: 0;
  flex: 1;
}

.budget-label {
  display: block;
  color: rgba(245, 241, 231, 0.57);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.budget-spent {
  display: block;
  margin-top: 2px;
  font-family: var(--font-serif);
  font-size: clamp(33px, 4vw, 43px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.2;
}

.budget-rule {
  width: 100%;
  height: 1px;
  margin: 17px 0 12px;
  background: rgba(255, 255, 255, 0.12);
}

.budget-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(245, 241, 231, 0.6);
  font-size: 11px;
}

.budget-meta-row strong {
  color: rgba(255, 253, 247, 0.9);
  font-size: 13px;
  font-weight: 600;
}

.budget-pace {
  margin: 11px 0 0;
  color: rgba(245, 241, 231, 0.54);
  font-size: 11px;
  line-height: 1.6;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 145px;
  border: 1px solid rgba(31, 48, 39, 0.07);
  border-radius: var(--radius-md);
  padding: 20px 21px 18px;
  background: rgba(251, 249, 243, 0.79);
  box-shadow: var(--shadow-sm);
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -11px;
  bottom: -26px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--stat-soft, var(--mint));
  opacity: 0.66;
}

.stat-expense { --stat-accent: var(--coral); --stat-soft: var(--coral-soft); }
.stat-income { --stat-accent: var(--green-bright); --stat-soft: var(--mint); }
.stat-balance { --stat-accent: #99702c; --stat-soft: var(--gold-soft); }
.stat-average { --stat-accent: var(--blue); --stat-soft: var(--blue-soft); }

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

.stat-label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.stat-mark {
  color: var(--stat-accent);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  opacity: 0.72;
}

.stat-card strong {
  position: relative;
  z-index: 1;
  margin-top: 13px;
  font-family: var(--font-serif);
  font-size: clamp(23px, 2.5vw, 31px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.stat-card small {
  position: relative;
  z-index: 1;
  margin-top: 6px;
  color: var(--ink-muted);
  font-size: 10px;
}

.stat-card small.is-positive { color: var(--green-bright); }
.stat-card small.is-negative { color: var(--coral); }
.stat-card strong.is-negative { color: var(--coral); }


.month-budget-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 1.08fr) minmax(230px, 0.86fr);
  align-items: center;
  gap: 34px;
  margin-bottom: 22px;
  border: 1px solid rgba(63, 109, 150, 0.14);
  border-radius: 24px;
  padding: 24px 30px;
  background:
    radial-gradient(circle at 100% 0%, rgba(126, 172, 207, 0.16), transparent 38%),
    linear-gradient(135deg, rgba(239, 246, 250, 0.94), rgba(250, 248, 242, 0.92));
  box-shadow: var(--shadow-sm);
  animation: rise-in 560ms 75ms ease both;
}

.month-budget-copy .panel-kicker {
  color: #426d93;
}

.month-budget-heading {
  display: flex;
  align-items: baseline;
  gap: 11px;
  margin-top: 2px;
}

.month-budget-heading h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.month-budget-range {
  color: var(--ink-muted);
  font-size: 9px;
  white-space: nowrap;
}

.month-budget-copy p {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-size: 10px;
  line-height: 1.65;
}

.month-budget-numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  border-left: 1px solid rgba(63, 109, 150, 0.12);
  border-right: 1px solid rgba(63, 109, 150, 0.12);
  padding: 2px 26px;
}

.month-budget-numbers span {
  display: block;
  color: var(--ink-muted);
  font-size: 9px;
  white-space: nowrap;
}

.month-budget-numbers strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-budget-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(63, 109, 150, 0.13);
}

.month-budget-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #83b8d8, #3e709b);
  transition: width 420ms cubic-bezier(0.2, 0.75, 0.3, 1), background 180ms ease;
}

.month-budget-progress span.is-over {
  background: linear-gradient(90deg, #e2a28f, #cc6f59);
}

.month-budget-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--ink-muted);
  font-size: 9px;
}

#editMonthBudgetButton {
  border: 0;
  padding: 0;
  background: transparent;
  color: #3f6d96;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

#editMonthBudgetButton:hover {
  color: #274f78;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.52fr) minmax(320px, 0.85fr);
  gap: 22px;
  align-items: start;
  animation: rise-in 580ms 100ms ease both;
}

.panel {
  border: 1px solid rgba(31, 48, 39, 0.075);
  border-radius: var(--radius-lg);
  background: rgba(251, 249, 243, 0.83);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.ledger-panel {
  min-height: 640px;
  padding: 30px 30px 20px;
}

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

.panel-head h2,
.insight-title h2 {
  margin: 2px 0 0;
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 23px;
  height: 21px;
  margin-left: 5px;
  border-radius: 999px;
  padding: 0 7px;
  background: var(--paper-deep);
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  vertical-align: 4px;
}

.filter-group {
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 3px;
  background: rgba(242, 239, 230, 0.64);
}

.filter-button {
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  padding: 0 11px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

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

.filter-button.is-active {
  background: var(--card-strong);
  color: var(--ink);
  box-shadow: 0 3px 9px rgba(28, 45, 36, 0.08);
}

.transaction-list {
  margin-top: 20px;
}

.day-group {
  padding: 0 4px 13px;
}

.day-group + .day-group {
  margin-top: 0;
  border-top: 1px solid rgba(31, 48, 39, 0.065);
  padding-top: 13px;
}

.day-group.is-empty {
  padding-bottom: 10px;
}

.day-group.is-empty .day-head {
  margin-bottom: 0;
}

.day-group.is-today .day-head strong {
  color: var(--green-bright);
}

.day-group.is-today .day-head small {
  color: var(--green-bright);
  font-weight: 650;
}

.day-empty {
  padding: 2px 0 0 54px;
  color: var(--ink-muted);
  font-size: 9px;
  font-style: italic;
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 27px;
  margin-bottom: 5px;
  padding: 0 5px;
}

.day-head > span:first-child {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.day-head strong {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.015em;
}

.day-head small {
  color: var(--ink-muted);
  font-size: 10px;
}

.day-head-right {
  display: flex;
  align-items: center;
  gap: 9px;
}

.day-subtotal {
  color: var(--ink-muted);
  font-size: 9px;
  letter-spacing: 0.015em;
}

.day-add-button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 253, 248, 0.65);
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.day-add-button:hover {
  border-color: rgba(37, 89, 67, 0.32);
  background: var(--mint);
  color: var(--green);
  transform: scale(1.05);
}

.day-add-button .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2;
}

.transaction-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  border-radius: 14px;
  padding: 7px 7px 7px 8px;
  transition: background 150ms ease;
}

.transaction-row:hover {
  background: rgba(242, 239, 230, 0.66);
}

.transaction-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.category-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: var(--cat-soft, var(--paper-deep));
  font-size: 20px;
  box-shadow: inset 0 0 0 1px rgba(31, 48, 39, 0.035);
}

.transaction-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.transaction-copy strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transaction-copy small {
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transaction-amount {
  flex: 0 0 auto;
  margin-left: auto;
  padding-left: 8px;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.transaction-amount.is-expense { color: var(--ink); }
.transaction-amount.is-income { color: var(--green-bright); }

.row-actions {
  display: flex;
  gap: 2px;
  width: 0;
  overflow: hidden;
  opacity: 0;
  transition: width 160ms ease, opacity 160ms ease;
}

.transaction-row:hover .row-actions,
.transaction-row:focus-within .row-actions {
  width: 58px;
  opacity: 1;
}

.row-action {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}

.row-action:hover {
  background: rgba(37, 89, 67, 0.09);
  color: var(--green);
}

.row-action.is-delete:hover {
  background: rgba(221, 107, 79, 0.1);
  color: var(--coral);
}

.row-action .icon {
  width: 14px;
  height: 14px;
}

.empty-state {
  display: flex;
  min-height: 440px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 55px;
  text-align: center;
}

.empty-illustration {
  position: relative;
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  margin-bottom: 21px;
  border-radius: 50%;
  background: var(--mint);
  color: var(--green);
}

.empty-illustration::before,
.empty-illustration::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(37, 89, 67, 0.13);
}

.empty-illustration::before {
  inset: -12px;
}

.empty-illustration::after {
  inset: -24px;
  border-color: rgba(37, 89, 67, 0.065);
}

.empty-illustration .icon {
  width: 37px;
  height: 37px;
  stroke-width: 1.35;
}

.empty-state h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 23px;
  font-weight: 600;
}

.empty-state p {
  max-width: 290px;
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.7;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.empty-actions .primary-button,
.empty-actions .secondary-button {
  min-height: 39px;
  border-radius: 11px;
  padding: 0 14px;
  font-size: 12px;
}

.filtered-empty {
  display: flex;
  min-height: 300px;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-size: 12px;
  text-align: center;
}

.side-column {
  display: grid;
  gap: 22px;
}

.chart-panel,
.daily-panel {
  padding: 26px 27px;
}

.compact-head {
  align-items: center;
}

.compact-head h2 {
  font-size: 21px;
}

.panel-note {
  color: var(--ink-muted);
  font-size: 10px;
}

.donut-layout {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 19px;
}

.donut-wrap {
  position: relative;
  width: 154px;
  height: 154px;
  flex: 0 0 auto;
}

#categoryDonut {
  display: block;
  width: 154px;
  height: 154px;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}

.donut-center span {
  color: var(--ink-muted);
  font-size: 9px;
}

.donut-center strong {
  max-width: 95px;
  overflow: hidden;
  margin-top: 1px;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-legend {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 8px;
}

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

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot);
}

.legend-name {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-value {
  color: var(--ink-muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.legend-empty {
  color: var(--ink-muted);
  font-size: 10px;
  line-height: 1.6;
}

.daily-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
  height: 153px;
  margin-top: 19px;
}

.daily-column {
  display: grid;
  grid-template-rows: 20px 1fr 18px;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.bar-value {
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  border-radius: 7px 7px 4px 4px;
  background: rgba(218, 228, 235, 0.58);
}

.bar-fill {
  width: 100%;
  min-height: 0;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #83b5d4, #3f719d);
  transition: height 450ms cubic-bezier(0.2, 0.75, 0.3, 1);
}

.daily-column.is-today .bar-fill {
  background: linear-gradient(180deg, #9ed8e1, #4f98aa);
}

.daily-column.is-weekend .bar-track {
  background: rgba(210, 224, 234, 0.72);
}

.daily-column > span {
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-column.is-today > span {
  color: #3f7f94;
  font-weight: 700;
}

.insight-panel {
  border-radius: var(--radius-lg);
  padding: 26px 27px 24px;
  background:
    radial-gradient(circle at 100% 0%, rgba(201, 154, 57, 0.12), transparent 35%),
    var(--gold-soft);
  box-shadow: var(--shadow-sm);
}

.insight-title {
  display: flex;
  align-items: center;
  gap: 11px;
}

.insight-spark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.62);
  color: var(--gold);
  font-size: 20px;
}

.insight-title h2 {
  font-size: 21px;
}

.insight-list {
  display: grid;
  gap: 11px;
  margin-top: 17px;
}

.insight-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 11px;
  padding-top: 10px;
  border-top: 1px solid rgba(84, 66, 28, 0.1);
}

.insight-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.insight-label {
  color: rgba(80, 62, 24, 0.56);
  font-size: 9px;
  letter-spacing: 0.05em;
  line-height: 1.6;
}

.insight-copy strong {
  display: block;
  color: #463a20;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.insight-copy p {
  margin: 2px 0 0;
  color: rgba(70, 58, 32, 0.62);
  font-size: 9px;
  line-height: 1.6;
}

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 0 6px;
  color: var(--ink-muted);
  font-size: 9px;
  letter-spacing: 0.025em;
}

.footer-dot {
  opacity: 0.55;
}

.primary-fab {
  position: fixed;
  z-index: 80;
  right: 34px;
  bottom: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0 23px 0 18px;
  background: linear-gradient(135deg, #34765a, #173d2e);
  color: #fffdf6;
  box-shadow: 0 18px 42px rgba(23, 61, 46, 0.32), 0 5px 14px rgba(23, 61, 46, 0.2);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 170ms ease, box-shadow 170ms ease, background 170ms ease;
}

.primary-fab:hover {
  background: linear-gradient(135deg, #3b8062, #123729);
  box-shadow: 0 22px 48px rgba(23, 61, 46, 0.38), 0 7px 18px rgba(23, 61, 46, 0.22);
  transform: translateY(-2px);
}

.primary-fab:active {
  transform: translateY(0);
}

.primary-fab .icon {
  width: 23px;
  height: 23px;
  stroke-width: 2;
}

.modal-layer[hidden] {
  display: none;
}

.modal-layer {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 31, 23, 0.42);
  backdrop-filter: blur(7px);
  animation: fade-in 180ms ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(820px, calc(100vh - 48px));
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 27px;
  padding: 26px 28px 24px;
  background: var(--card-strong);
  box-shadow: var(--shadow-lg);
  animation: modal-in 220ms cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

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

.budget-modal-card {
  width: min(450px, 100%);
}

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

.modal-head h2 {
  margin: 2px 0 0;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid var(--line);
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}

.modal-close:hover {
  background: var(--paper);
  color: var(--ink);
}

.type-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border-radius: 12px;
  padding: 4px;
  background: var(--paper);
}

.type-switch button {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.type-switch button.is-active {
  background: var(--card-strong);
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(28, 45, 36, 0.08);
}

.type-switch button[data-type="expense"].is-active {
  color: var(--coral);
}

.type-switch button[data-type="income"].is-active {
  color: var(--green);
}

.amount-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0 9px;
  border-bottom: 1px solid var(--line-strong);
  padding: 0 3px 8px;
}

.amount-field > span {
  color: var(--ink-muted);
  font-family: var(--font-serif);
  font-size: 27px;
}

.amount-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 47px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.amount-field input::placeholder {
  color: #c5c2b9;
}

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

.quick-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.quick-amounts button {
  min-width: 51px;
  height: 29px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 10px;
  cursor: pointer;
}

.quick-amounts button:hover {
  border-color: rgba(37, 89, 67, 0.3);
  background: rgba(37, 89, 67, 0.05);
  color: var(--green);
}

.category-fieldset {
  margin: 20px 0 0;
  border: 0;
  padding: 0;
}

.category-fieldset legend,
.form-row label > span {
  margin-bottom: 9px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.category-option {
  display: flex;
  min-height: 57px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 4px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 10px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.category-option:hover {
  border-color: rgba(37, 89, 67, 0.25);
  background: rgba(37, 89, 67, 0.035);
  transform: translateY(-1px);
}

.category-option.is-selected {
  border-color: var(--option-color);
  background: var(--option-soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--option-color);
}

.category-option .category-emoji {
  font-size: 19px;
  line-height: 1.15;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  gap: 13px;
  margin-top: 18px;
}

.form-row label {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.form-row label em {
  color: var(--ink-muted);
  font-style: normal;
  font-weight: 400;
}

.form-row input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 11px;
  background: #f8f5ed;
  color: var(--ink);
  font-size: 11px;
}

.form-row input:focus {
  border-color: rgba(37, 89, 67, 0.34);
  background: #fffdf8;
  outline: 3px solid rgba(37, 89, 67, 0.08);
}

.form-error {
  min-height: 17px;
  margin: 8px 0 0;
  color: var(--coral);
  font-size: 10px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}

.action-spacer {
  flex: 1;
}

.modal-actions .primary-button,
.modal-actions .secondary-button {
  min-height: 42px;
  border-radius: 11px;
}

.danger-text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  border: 0;
  padding: 0 7px;
  background: transparent;
  color: var(--coral);
  font-size: 11px;
  cursor: pointer;
}

.danger-text-button .icon {
  width: 15px;
  height: 15px;
}

.modal-description {
  margin: -4px 0 13px;
  color: var(--ink-muted);
  font-size: 11px;
  line-height: 1.65;
}

.budget-amount-field {
  margin-top: 12px;
}

.budget-amount-field input {
  font-size: 42px;
}

.budget-quick-amounts {
  margin-top: 6px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--ink-soft);
  font-size: 11px;
  cursor: pointer;
}

.check-row input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--green);
}

.reset-week-budget {
  margin-top: 10px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--green-bright);
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.toast {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: 26px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  max-width: min(480px, calc(100% - 32px));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 0 10px 0 17px;
  background: rgba(25, 45, 35, 0.96);
  color: #f7f3e9;
  box-shadow: 0 18px 45px rgba(17, 32, 24, 0.27);
  font-size: 12px;
  transform: translateX(-50%);
  animation: toast-in 220ms ease both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.toast > span {
  min-width: 0;
}

#toastAction {
  border: 0;
  border-radius: 8px;
  padding: 6px 9px;
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

#toastAction:hover {
  background: rgba(255, 255, 255, 0.2);
}

#toastClose {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.56);
  cursor: pointer;
}

#toastClose:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

#toastClose .icon {
  width: 14px;
  height: 14px;
}

@media (max-width: 1050px) {
  .page-shell {
    width: min(960px, calc(100% - 48px));
  }

  .month-budget-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 22px 30px;
  }

  .month-budget-progress-area {
    grid-column: 1 / -1;
  }

  .dashboard-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 132px;
  }

  .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .insight-panel {
    grid-column: 1 / -1;
  }

  .insight-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .insight-item {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 0 13px 0 0;
    border-top: 0;
    border-left: 1px solid rgba(84, 66, 28, 0.1);
    padding-left: 13px;
  }

  .insight-item:first-child {
    border-left: 0;
    padding-left: 0;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: calc(100% - 32px);
    padding-top: 20px;
  }

  .topbar {
    margin-bottom: 36px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px 13px 13px 5px;
    font-size: 21px;
  }

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

  .brand-copy small {
    display: none;
  }

  .quiet-button {
    width: 41px;
    padding: 0;
  }

  .quiet-button span {
    display: none;
  }

  .top-add-button {
    display: none;
  }

  .week-bar {
    align-items: center;
    margin-bottom: 21px;
  }

  .week-range-line h1 {
    font-size: 29px;
    letter-spacing: -0.04em;
  }

  .week-range-line {
    gap: 8px;
  }

  .week-chip {
    padding: 4px 8px;
    font-size: 9px;
  }

  .today-button {
    display: none;
  }

  .round-button {
    width: 36px;
    height: 36px;
  }

  .budget-card {
    min-height: auto;
    border-radius: 23px;
    padding: 21px 20px 20px;
  }

  .budget-card-body {
    gap: 21px;
    margin-top: 19px;
  }

  .budget-ring {
    width: 143px;
    height: 143px;
  }

  .budget-ring::after {
    width: 119px;
    height: 119px;
  }

  .budget-ring-inner strong {
    font-size: 22px;
  }

  .budget-spent {
    font-size: 32px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 122px;
    border-radius: 17px;
    padding: 15px 16px 14px;
  }

  .stat-card strong {
    font-size: 25px;
  }

  .ledger-panel {
    min-height: 520px;
    border-radius: 23px;
    padding: 24px 20px 15px;
  }

  .panel-head h2,
  .insight-title h2 {
    font-size: 22px;
  }

  .filter-group {
    gap: 1px;
  }

  .filter-button {
    padding: 0 8px;
  }

  .transaction-row {
    gap: 5px;
  }

  .row-actions {
    width: 54px;
    opacity: 1;
  }

  .row-action {
    width: 25px;
    height: 25px;
  }

  .category-avatar {
    width: 39px;
    height: 39px;
    border-radius: 12px;
    font-size: 18px;
  }

  .transaction-amount {
    font-size: 14px;
  }

  .side-column {
    grid-template-columns: minmax(0, 1fr);
  }

  .insight-panel {
    grid-column: auto;
    border-radius: 23px;
  }

  .insight-list {
    grid-template-columns: 1fr;
  }

  .insight-item,
  .insight-item:first-child {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 11px;
    border-left: 0;
    padding: 10px 0 0;
    border-top: 1px solid rgba(84, 66, 28, 0.1);
  }

  .insight-item:first-child {
    padding-top: 0;
    border-top: 0;
  }

  .chart-panel,
  .daily-panel {
    border-radius: 23px;
    padding: 23px 21px;
  }

  .month-budget-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    border-radius: 21px;
    padding: 22px 20px;
  }

  .month-budget-numbers {
    gap: 12px;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid rgba(63, 109, 150, 0.12);
    border-bottom: 1px solid rgba(63, 109, 150, 0.12);
    padding: 14px 0;
  }

  .month-budget-numbers strong {
    font-size: 19px;
  }

  .month-budget-progress-area {
    grid-column: auto;
  }

  .donut-layout {
    gap: 12px;
  }

  .donut-wrap {
    width: 137px;
    height: 137px;
  }

  #categoryDonut {
    width: 137px;
    height: 137px;
  }

  .primary-fab {
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    height: 54px;
    padding: 0 19px 0 16px;
    font-size: 13px;
  }

  .primary-fab .icon {
    width: 21px;
    height: 21px;
  }

  .modal-layer {
    align-items: end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100vh - 22px);
    border-radius: 24px 24px 0 0;
    padding: 23px 20px max(20px, env(safe-area-inset-bottom));
  }

  .budget-modal-card {
    width: 100%;
  }

  .amount-field input {
    font-size: 42px;
  }

  .toast {
    bottom: 84px;
  }

  footer {
    padding-bottom: 86px;
  }
}

@media (max-width: 480px) {
  .week-range-line h1 {
    font-size: 25px;
  }

  .week-heading {
    min-width: 0;
  }

  .eyebrow {
    font-size: 9px;
  }

  .budget-card-body {
    align-items: center;
    gap: 15px;
  }

  .budget-ring {
    width: 125px;
    height: 125px;
  }

  .budget-ring::after {
    width: 104px;
    height: 104px;
  }

  .budget-ring-inner strong {
    font-size: 19px;
  }

  .budget-ring-inner span,
  .budget-ring-inner small {
    font-size: 9px;
  }

  .budget-spent {
    font-size: 28px;
  }

  .budget-rule {
    margin: 13px 0 10px;
  }

  .budget-card-head p {
    font-size: 18px;
  }

  .stat-card strong {
    font-size: 22px;
  }

  .stat-mark {
    display: none;
  }

  .category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .category-option {
    min-height: 52px;
    font-size: 9px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .donut-wrap {
    width: 123px;
    height: 123px;
  }

  #categoryDonut {
    width: 123px;
    height: 123px;
  }

  .donut-center strong {
    font-size: 17px;
  }

  .legend-item {
    gap: 6px;
  }
}

@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;
  }
}


/* Native macOS app shell */
html.native-app body {
  overscroll-behavior: none;
}

html.native-app .page-shell {
  width: min(1180px, calc(100% - 56px));
  padding-top: 28px;
}

html.native-app .topbar {
  margin-bottom: 50px;
}

@media (max-width: 760px) {
  html.native-app .page-shell {
    width: calc(100% - 32px);
    padding-top: 18px;
  }
}

/* Budget scope */
.budget-scope-field {
  margin-top: 18px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.budget-scope-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.budget-scope-switch button {
  display: flex;
  min-height: 55px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 8px 12px;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.budget-scope-switch button:hover {
  border-color: rgba(63, 109, 150, 0.28);
  background: rgba(63, 109, 150, 0.045);
}

.budget-scope-switch button.is-active {
  border-color: rgba(63, 109, 150, 0.48);
  background: #edf4f8;
  box-shadow: inset 0 0 0 1px rgba(63, 109, 150, 0.16);
}

.budget-scope-switch strong {
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
}

.budget-scope-switch small {
  color: var(--ink-muted);
  font-size: 8.5px;
}

.transaction-title-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.transaction-title-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-badge {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 16px;
  border-radius: 5px;
  padding: 0 5px;
  font-size: 8px;
  font-weight: 750;
  line-height: 1;
  flex: 0 0 auto;
}

.scope-badge.is-week {
  background: var(--mint);
  color: var(--green);
}

.scope-badge.is-month {
  background: #e0eaf3;
  color: #3d6c96;
}

/* Weekly category budgets */
.category-budget-panel {
  padding: 26px 27px 24px;
}

.panel-action-button {
  min-height: 29px;
  border: 1px solid rgba(63, 109, 150, 0.2);
  border-radius: 999px;
  padding: 0 11px;
  background: rgba(255, 253, 248, 0.55);
  color: #3f6d96;
  font-size: 9px;
  font-weight: 650;
  cursor: pointer;
}

.panel-action-button:hover {
  border-color: rgba(63, 109, 150, 0.38);
  background: #edf4f8;
}

.category-budget-list {
  display: grid;
  gap: 11px;
  margin-top: 18px;
}

.category-budget-empty {
  border-radius: 13px;
  padding: 17px;
  background: rgba(63, 109, 150, 0.055);
  text-align: center;
}

.category-budget-empty p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 10px;
  line-height: 1.65;
}

.category-budget-empty button {
  margin-top: 10px;
  border: 0;
  padding: 0;
  background: transparent;
  color: #3f6d96;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.category-budget-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}

.category-budget-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
}

.category-budget-emoji {
  font-size: 13px;
}

.category-budget-value {
  color: var(--ink-muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.category-budget-row.is-over .category-budget-value {
  color: var(--coral);
}

.category-budget-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(63, 109, 150, 0.1);
}

.category-budget-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--category-color, #4d8cb4);
}

.category-budget-row.is-over .category-budget-track span {
  background: var(--coral);
}

.category-budget-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 11px;
  color: var(--ink-muted);
  font-size: 8.5px;
}

.category-budget-footer.is-over {
  color: var(--coral);
}

/* Category budget editor */
.category-budget-modal-card {
  width: min(620px, 100%);
}

.category-budget-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin-top: 8px;
}

.category-budget-input-row {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  background: #f9f7f0;
}

.category-budget-input-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.category-budget-input-label > span {
  font-size: 15px;
}

.category-budget-input-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--ink-muted);
  font-size: 10px;
}

.category-budget-input-wrap input {
  width: 86px;
  height: 29px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 0 3px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  text-align: right;
}

.category-budget-input-wrap input:focus {
  border-color: #4d83ad;
  outline: 0;
}

.category-budget-total {
  margin: 13px 0 0;
  color: var(--ink-muted);
  font-size: 9px;
  text-align: right;
}

.category-budget-total.is-over {
  color: var(--coral);
}

@media (max-width: 760px) {
  .category-budget-panel {
    padding: 23px 21px;
  }

  .category-budget-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .category-budget-input-wrap input {
    width: 100px;
  }
}

/* Note history suggestions */
.note-suggestions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
}

.note-suggestions-label {
  flex: 0 0 auto;
  padding-top: 6px;
  color: var(--ink-muted);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.note-suggestion-list {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-wrap: wrap;
  gap: 6px;
}

.note-suggestion-chip {
  max-width: 150px;
  overflow: hidden;
  min-height: 25px;
  border: 1px solid rgba(63, 109, 150, 0.17);
  border-radius: 999px;
  padding: 3px 10px;
  background: rgba(237, 244, 248, 0.72);
  color: #3f6d96;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.note-suggestion-chip:hover {
  border-color: rgba(63, 109, 150, 0.36);
  background: #e5f0f6;
  color: #28557f;
}

@media (max-width: 480px) {
  .note-suggestions {
    flex-direction: column;
    gap: 6px;
  }

  .note-suggestions-label {
    padding-top: 0;
  }

  .note-suggestion-chip {
    max-width: 100%;
  }
}

/* Cloud sync */
.sync-status-button {
  position: relative;
}

.sync-status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #a9aaa4;
  box-shadow: 0 0 0 3px rgba(169, 170, 164, 0.12);
}

.sync-status-dot.is-synced {
  background: #4c9275;
  box-shadow: 0 0 0 3px rgba(76, 146, 117, 0.14);
}

.sync-status-dot.is-syncing {
  background: #5f96bc;
  box-shadow: 0 0 0 3px rgba(95, 150, 188, 0.14);
  animation: sync-pulse 1.2s ease-in-out infinite;
}

.sync-status-dot.is-error {
  background: var(--coral);
  box-shadow: 0 0 0 3px rgba(221, 107, 79, 0.14);
}

@keyframes sync-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.88); }
  50% { opacity: 1; transform: scale(1.08); }
}

.sync-modal-card {
  width: min(570px, 100%);
}

.sync-overview {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(63, 109, 150, 0.13);
  border-radius: 14px;
  padding: 15px 16px;
  background: rgba(237, 244, 248, 0.62);
}

.sync-status-indicator {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #a9aaa4;
  box-shadow: 0 0 0 5px rgba(169, 170, 164, 0.1);
}

.sync-status-indicator.is-synced {
  background: #4c9275;
  box-shadow: 0 0 0 5px rgba(76, 146, 117, 0.12);
}

.sync-status-indicator.is-syncing {
  background: #5f96bc;
  box-shadow: 0 0 0 5px rgba(95, 150, 188, 0.12);
  animation: sync-pulse 1.2s ease-in-out infinite;
}

.sync-status-indicator.is-error {
  background: var(--coral);
  box-shadow: 0 0 0 5px rgba(221, 107, 79, 0.12);
}

.sync-overview h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
}

.sync-overview p {
  margin: 3px 0 0;
  color: var(--ink-muted);
  font-size: 10px;
  line-height: 1.55;
}

#syncSetupView,
#syncConnectedView {
  margin-top: 19px;
}

.sync-create-button {
  width: 100%;
  min-height: 45px;
}

.sync-help,
.sync-connected-note {
  margin: 9px 0 0;
  color: var(--ink-muted);
  font-size: 9px;
  line-height: 1.65;
  text-align: center;
}

.sync-divider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0 17px;
  color: var(--ink-muted);
  font-size: 8px;
  letter-spacing: 0.05em;
}

.sync-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--line);
}

.sync-divider span {
  position: relative;
  padding: 0 10px;
  background: var(--card-strong);
}

.sync-input-label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
}

.sync-code-input-row {
  display: flex;
  gap: 8px;
}

.sync-code-input-row input {
  min-width: 0;
  flex: 1;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 11px;
  background: #f8f5ed;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.sync-code-input-row input:focus {
  border-color: rgba(63, 109, 150, 0.38);
  outline: 3px solid rgba(63, 109, 150, 0.08);
}

.sync-code-input-row .secondary-button {
  min-height: 42px;
  border-radius: 10px;
}

.sync-code-card,
.sync-install-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(63, 109, 150, 0.14);
  border-radius: 12px;
  padding: 11px 12px;
  background: #f5f8fa;
}

.sync-install-hint {
  margin-top: 8px;
}

.sync-code-card > div,
.sync-install-hint > span {
  min-width: 0;
}

.sync-code-card span,
.sync-install-hint span {
  display: block;
  margin-bottom: 3px;
  color: var(--ink-muted);
  font-size: 8px;
}

.sync-code-card code,
.sync-install-hint code {
  display: block;
  overflow: hidden;
  color: #345f86;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-code-card button,
.sync-install-hint button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 7px;
  padding: 6px 9px;
  background: rgba(63, 109, 150, 0.09);
  color: #3f6d96;
  font-size: 9px;
  font-weight: 650;
  cursor: pointer;
}

.sync-code-card button:hover,
.sync-install-hint button:hover {
  background: rgba(63, 109, 150, 0.15);
}

.sync-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.sync-actions .primary-button {
  flex: 1;
}

.sync-actions .danger-text-button {
  min-height: 42px;
  margin-left: auto;
}

.sync-security-note {
  margin: 12px 0 0;
  color: var(--ink-muted);
  font-size: 8px;
  line-height: 1.6;
  text-align: center;
}

@media (max-width: 760px) {
  .quiet-button .sync-status-dot {
    display: block;
  }

  .sync-status-button {
    width: 41px;
    padding: 0;
  }

  .sync-status-button .sync-status-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 6px;
    height: 6px;
    box-shadow: 0 0 0 2px rgba(255, 253, 248, 0.9);
  }

  .sync-status-button .icon {
    width: 17px;
    height: 17px;
  }

  .sync-code-input-row {
    flex-direction: column;
  }

  .sync-code-input-row .secondary-button {
    width: 100%;
  }
}


.sync-qr-wrap {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 12px;
  border: 1px solid rgba(63, 109, 150, 0.13);
  border-radius: 14px;
  padding: 12px 15px;
  background: rgba(247, 250, 251, 0.88);
}

.sync-qr-wrap img {
  width: 92px;
  height: 92px;
  flex: 0 0 auto;
  border-radius: 8px;
  image-rendering: pixelated;
}

.sync-qr-wrap p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 10px;
  line-height: 1.7;
}

@media (max-width: 480px) {
  .sync-qr-wrap {
    flex-direction: column;
    text-align: center;
  }
}
