:root {
  --bg: #f3f6f3;
  --panel: #fff;
  --text: #192e26;
  --muted: #5c7066;
  --soft: #f6f8f5;
  --line: #dce4dd;
  --track: #eaf0e9;
  --accent: #17513e;
  --onaccent: #fff;
  --tint: #e7f0e6;
  --shadow: 0 3px 12px #1b3c2a05;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111c17;
  --panel: #192820;
  --text: #ecf4eb;
  --muted: #a9b9ad;
  --soft: #203128;
  --line: #384a3e;
  --track: #34473a;
  --accent: #a4d6b1;
  --onaccent: #102719;
  --tint: #294634;
  --shadow: none;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    15px/1.45 Inter,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
select {
  cursor: pointer;
}
button {
  border: 0;
  background: transparent;
}
button,
select,
input,
textarea {
  border-radius: 7px;
}
button {
  transition:
    background 0.16s,
    transform 0.16s,
    color 0.16s;
}
button:active:enabled {
  transform: translateY(1px);
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #729e70;
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
svg {
  flex-shrink: 0;
  vertical-align: middle;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3,
strong,
b {
  font-weight: 650;
}
h1 {
  font-size: clamp(28px, 2.3vw, 36px);
  line-height: 1.13;
  letter-spacing: -1.5px;
}
h2 {
  font-size: 20px;
  letter-spacing: -0.72px;
  line-height: 1.22;
}
h3 {
  font-size: 15px;
  letter-spacing: -0.22px;
}
#top {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.top-inner,
main {
  width: min(1320px, calc(100% - clamp(48px, 9vw, 156px)));
  margin: auto;
}
.top-inner {
  height: 76px;
  display: flex;
  align-items: center;
  gap: clamp(30px, 5vw, 78px);
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  font-weight: 720;
  letter-spacing: -1.25px;
  font-size: 26px;
  padding: 0;
}
.desktop-nav,
.top-tools,
.heading-actions,
.panel-title,
.stat,
.budget-line,
.cat-pair,
.ledger-foot,
.ledger-foot > div,
.dialog-head,
.dialog-actions,
.inline-tools {
  display: flex;
  align-items: center;
}
.desktop-nav {
  gap: 7px;
}
.navitem,
.mode-btn,
.btn,
.text-btn,
.icon-btn,
.pager,
.hero-label,
.delta,
.comparison,
.expense-name,
.chip,
.tile,
.mini,
.stat-name,
.budget h3,
.search,
.cat-pair > span,
.status,
footer,
.quick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.navitem {
  padding: 10px 15px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 570;
}
.navitem.active,
.navitem:hover,
.mode-btn:hover {
  background: var(--tint);
  color: var(--accent);
}
.top-tools {
  margin-left: auto;
  gap: 8px;
}
.mode-btn {
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 620;
  border-radius: 20px;
  padding: 6px 11px;
  color: var(--accent);
  background: var(--soft);
  margin-right: 7px;
}
.mode-btn svg {
  width: 14px;
  height: 14px;
}
.icon-btn {
  width: 37px;
  height: 37px;
  color: var(--muted);
}
.icon-btn:hover,
.text-btn:hover,
.pager:enabled:hover {
  background: var(--tint);
  color: var(--accent);
}
main {
  padding: 36px 0 18px;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 25px;
}
.page-heading p,
.submonth {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}
.heading-actions {
  gap: 10px;
}
.btn {
  min-height: 42px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 9px 15px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.btn:hover {
  background: var(--soft);
  border-color: #a9bbae;
}
.btn.primary {
  background: var(--accent);
  color: var(--onaccent);
  border-color: var(--accent);
}
.btn.primary:hover {
  filter: brightness(1.1);
}
.period {
  gap: 10px;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 2.02fr) minmax(305px, 1fr);
  gap: 22px;
  align-items: start;
}
.stack {
  display: grid;
  gap: 20px;
  min-width: 0;
}
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 197px;
  display: flex;
  align-items: center;
  border-radius: 17px;
  background: linear-gradient(108deg, #113f35 10%, #205641 70%, #356a50);
  color: #fff;
  box-shadow: var(--shadow);
}
.rings {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: repeating-radial-gradient(
    circle at 89% 116%,
    transparent 0 22px,
    #bbd5af1a 22.5px 23.3px,
    transparent 24px 28px
  );
  mask-image: linear-gradient(90deg, transparent 20%, black 70%);
}
.hero-art {
  position: absolute;
  z-index: -1;
  right: -3%;
  top: 0;
  width: 49%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(3px 10px 7px #0c2e2536);
}
.hero-text {
  padding: 28px 32px;
}
.hero-label {
  color: #e1efdf;
  font-weight: 560;
  font-size: 15px;
  gap: 10px;
}
.hero-label svg {
  color: #c9e9bd;
}
.hero-money {
  font-size: clamp(37px, 3.4vw, 57px);
  line-height: 1.22;
  letter-spacing: -2.3px;
  font-weight: 590;
  margin: 8px 0 18px;
  font-variant-numeric: tabular-nums;
}
.hero-money small {
  font-size: 0.4em;
  color: #dbe9d7;
  font-weight: 520;
  letter-spacing: 0;
}
.comparison {
  color: #dbebdb;
  font-size: 12px;
  gap: 9px;
}
.delta {
  font-size: 12px;
  font-weight: 620;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  background: #d4eeb823;
  color: #d8efbc;
}
.up {
  transform: scaleY(-1);
}
.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
}
.summary,
.breakdown,
.annual,
.recurring {
  padding: 23px 24px;
}
.panel-title,
.stat,
.budget-line,
.cat-pair,
.ledger-foot,
.dialog-head {
  justify-content: space-between;
  gap: 10px;
}
.panel-title > svg {
  color: var(--muted);
}
.currency {
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 4px 5px 4px 8px;
  font-size: 12px;
  font-weight: 620;
  min-height: 29px;
}
.submonth {
  margin-top: 4px;
}
.stats {
  padding: 14px 0 16px;
  display: grid;
  gap: 4px;
}
.stat {
  min-height: 31px;
  font-size: 13px;
}
.stat-name {
  color: var(--muted);
  gap: 10px;
}
.stat strong,
.budget-line,
.amount {
  font-variant-numeric: tabular-nums;
}
.stat strong {
  white-space: nowrap;
  font-size: 14px;
}
.budget {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.budget h3 {
  gap: 8px;
}
.budget .icon-btn {
  width: 30px;
  height: 30px;
}
.budget-line {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0 9px;
}
.budget-line b {
  color: var(--accent);
}
.bar {
  display: block;
  width: 100%;
  height: 5px;
  border-radius: 8px;
  overflow: hidden;
}
.budget .bar {
  height: 7px;
}
.budget-note {
  font-size: 12px;
  margin-top: 8px;
  color: var(--muted);
}
.budget-note b {
  color: var(--text);
  font-weight: 590;
}
.alert,
.error {
  font-size: 13px;
  color: #a95728;
}
.breakdown .submonth {
  margin-bottom: 18px;
}
.cat-row + .cat-row {
  margin-top: 14px;
}
.cat-pair {
  font-size: 13px;
  margin-bottom: 6px;
}
.cat-pair > span {
  gap: 8px;
  font-weight: 550;
}
.cat-pair > b {
  font-size: 12px;
  color: var(--muted);
}
.mini,
.chip,
.tile {
  background: var(--pastel);
  color: var(--ink);
}
.mini {
  width: 24px;
  height: 24px;
  border-radius: 7px;
}
.text-btn {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 8px;
}
.category-more {
  margin: 15px 0 -6px;
}
.category-more svg {
  width: 14px;
}
.ledger {
  overflow: hidden;
}
.ledger-head {
  padding: 21px 24px 17px;
}
.export {
  font-size: 12px;
}
.export svg {
  width: 15px;
}
.search-row {
  display: flex;
  gap: 10px;
  margin-top: 17px;
}
.search {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 0 12px;
  color: var(--muted);
}
.search:focus-within {
  outline: 2px solid #8ab495;
}
.search input {
  width: 100%;
  min-width: 0;
  outline: none;
  background: transparent;
  border: 0;
  height: 38px;
  font-size: 13px;
}
.search input:focus-visible {
  outline: 0;
}
.filter-btn {
  font-size: 13px;
  min-height: 39px;
  padding: 6px 12px;
}
.filter-btn svg {
  width: 16px;
}
.ledger table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.ledger th {
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  padding: 9px 7px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.ledger th:first-child,
.ledger td:first-child {
  padding-left: 24px;
}
.ledger th:last-child,
.ledger td:last-child {
  padding-right: 24px;
  text-align: right;
}
.ledger td {
  padding: 11px 7px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.ledger tbody tr:hover {
  background: var(--soft);
  cursor: pointer;
}
.expense-name {
  text-align: left;
  justify-content: flex-start;
  font-weight: 600;
  gap: 12px;
  padding: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.tile {
  width: 35px;
  height: 35px;
  flex-shrink: 0;
  border-radius: 10px;
}
.chip {
  border-radius: 6px;
  padding: 3px 7px;
  gap: 4px;
  font-size: 11px;
  font-weight: 580;
  overflow-wrap: anywhere;
}
.mobile-date {
  display: none;
}
.date-cell {
  white-space: nowrap;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.amount {
  font-weight: 650;
  white-space: nowrap;
}
.amount small {
  font-size: 10px;
  color: var(--muted);
  font-weight: 550;
}
.ledger-foot {
  padding: 13px 24px;
  color: var(--muted);
  font-size: 12px;
}
.ledger-foot > div {
  gap: 5px;
}
.pager {
  border: 1px solid var(--line);
  width: 29px;
  height: 29px;
}
.empty,
.blank {
  text-align: center;
  color: var(--muted);
  padding: 30px 15px;
}
.empty h3 {
  color: var(--text);
  margin: 8px 0;
}
.empty p {
  font-size: 14px;
}
footer {
  color: var(--muted);
  font-size: 11px;
  margin-top: 19px;
  gap: 6px;
}
#mobile {
  display: none;
}
.annual-chart {
  display: flex;
  gap: 1.8%;
  height: 145px;
  margin-top: 22px;
}
.annual-chart button {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  font-size: 11px;
  color: var(--muted);
}
.annual-chart svg {
  width: 60%;
  height: 115px;
}
.rule-row,
.setting-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.rule-row:first-of-type {
  margin-top: 15px;
}
.rule-info,
.setting-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.rule-info small,
.setting-text small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.compact {
  font-size: 12px;
  min-height: 34px;
}
.status {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
dialog {
  width: min(480px, calc(100% - 28px));
  max-height: 90dvh;
  overflow: auto;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 0;
  box-shadow: 0 25px 90px #071c2240;
}
dialog::backdrop {
  background: #10251c65;
  backdrop-filter: blur(3px);
}
dialog[open] {
  animation: enter 0.14s ease-out;
}
@keyframes enter {
  from {
    opacity: 0.4;
    transform: translateY(6px);
  }
}
.dialog-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 {
  font-size: 20px;
}
.dialog-content {
  padding: 20px 23px;
}
.dialog-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 19px;
}
.field {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 13px;
  min-width: 0;
}
.field input,
.field select,
.field textarea,
.year-input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  background: var(--soft);
  font-weight: 450;
}
.field textarea {
  resize: vertical;
  min-height: 62px;
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.dialog-content > p,
.help {
  color: var(--muted);
  font-size: 14px;
}
.inline-tools {
  gap: 6px;
  flex-wrap: wrap;
  margin: 7px 0 16px;
}
.quick {
  color: var(--accent);
  background: var(--tint);
  border: 1px solid var(--line);
  padding: 6px 9px;
  font-size: 12px;
}
.error {
  color: #ae453e;
  margin: 8px 0;
  white-space: normal;
}
.danger {
  color: #ac463e;
  margin-right: auto;
}
.notice {
  background: var(--soft);
  border-radius: 9px;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  margin: 14px 0;
}
.settings-list {
  margin: 8px 0;
}
.setting-text {
  font-size: 14px;
}
.setting-row .btn {
  font-size: 12px;
  min-height: 37px;
  padding: 7px 10px;
}
.setting-row {
  flex-wrap: wrap;
}
.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.choice-grid button {
  padding: 12px 5px;
  border: 1px solid var(--line);
  font-size: 14px;
}
.choice-grid button.selected,
.choice-grid button:hover {
  background: var(--tint);
  color: var(--accent);
}
.year-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}
.year-input {
  width: 95px;
  text-align: center;
}
.date-wrap {
  display: flex;
  align-items: center;
  position: relative;
}
.date-wrap > input:first-child {
  padding-right: 42px;
}
.cal-trigger {
  position: absolute;
  right: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 100%;
  color: var(--muted);
  overflow: hidden;
}
.cal-trigger input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}
.cal-trigger input::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  height: auto;
  width: auto;
  cursor: pointer;
}
#toast {
  position: fixed;
  z-index: 5;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 10px;
  background: #1a4031;
  color: white;
  box-shadow: 0 6px 22px #0002;
  font-size: 14px;
  max-width: 85%;
  text-align: center;
}
#toast:not(:empty) {
  padding: 10px 18px;
}
@media (min-width: 1600px) {
  main {
    padding-top: 44px;
  }
  .hero {
    min-height: 212px;
  }
  .ledger td {
    padding-top: 14px;
    padding-bottom: 14px;
  }
}
@media (max-width: 1120px) {
  .top-inner,
  main {
    width: calc(100% - 48px);
  }
  .layout {
    gap: 16px;
    grid-template-columns: minmax(0, 1.85fr) minmax(290px, 1fr);
  }
  .summary,
  .breakdown {
    padding: 20px;
  }
  .ledger-head {
    padding: 18px;
  }
  .ledger th:first-child,
  .ledger td:first-child {
    padding-left: 16px;
  }
  .ledger th:last-child,
  .ledger td:last-child {
    padding-right: 16px;
  }
  .ledger td {
    font-size: 12px;
  }
  .hero-text {
    padding: 24px;
  }
  .top-inner {
    gap: 30px;
  }
  .navitem {
    padding: 9px 11px;
  }
}
@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 278px;
  }
  .date-cell,
  .ledger th:nth-child(3) {
    display: none;
  }
  .mobile-date {
    display: block;
    font-weight: 400;
    color: var(--muted);
    font-size: 11px;
    margin-top: 2px;
  }
  .hero-art {
    right: -9%;
    opacity: 0.83;
  }
  .hero-money {
    font-size: 36px;
  }
  .expense-name {
    gap: 7px;
  }
  .top-inner {
    gap: 15px;
  }
  .navitem {
    font-size: 13px;
    padding: 9px;
  }
  .top-tools {
    gap: 2px;
  }
}
@media (max-width: 760px) {
  .top-inner,
  main {
    width: calc(100% - 32px);
  }
  .top-inner {
    height: 61px;
  }
  .brand {
    font-size: 23px;
    gap: 7px;
  }
  .brand svg {
    width: 32px;
    height: 32px;
  }
  .desktop-nav {
    display: none;
  }
  .top-tools {
    gap: 1px;
  }
  .mode-btn {
    font-size: 11px;
    margin-right: 1px;
    padding: 5px 7px;
  }
  .icon-btn {
    width: 38px;
    height: 42px;
  }
  .layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .stack {
    width: 100%;
    gap: 16px;
  }
  .hero {
    min-height: 163px;
  }
  .hero-text {
    padding: 21px;
  }
  .hero-art {
    width: 46%;
    right: -7%;
  }
  .hero-money {
    font-size: clamp(33px, 7.5vw, 43px);
    margin: 8px 0 12px;
  }
  .hero-label {
    font-size: 14px;
  }
  .comparison {
    font-size: 10.5px;
    gap: 6px;
  }
  .delta {
    font-size: 11px;
    padding: 3px 6px;
  }
  main {
    padding: 24px 0 90px;
  }
  .page-heading {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 15px;
  }
  .page-heading p {
    font-size: 12px;
  }
  .heading-actions {
    width: 100%;
    justify-content: space-between;
  }
  .heading-actions .btn {
    min-height: 42px;
    padding: 8px 12px;
    font-size: 13px;
  }
  .page-heading h1 {
    font-size: 29px;
  }
  .panel {
    border-radius: 13px;
  }
  h2 {
    font-size: 19px;
  }
  .ledger-head {
    padding: 16px;
  }
  .search-row {
    margin-top: 13px;
  }
  .search input,
  .filter-btn {
    height: 42px;
  }
  .ledger td:nth-child(2),
  .ledger th:nth-child(2) {
    display: none;
  }
  .ledger td {
    padding: 10px 4px;
    font-size: 13px;
  }
  .tile {
    width: 34px;
    height: 34px;
  }
  .ledger td:first-child,
  .ledger th:first-child {
    padding-left: 13px;
  }
  .ledger td:last-child,
  .ledger th:last-child {
    padding-right: 13px;
  }
  .ledger-foot {
    padding: 9px 14px;
  }
  .pager {
    width: 42px;
    height: 42px;
  }
  .ledger .export {
    min-height: 40px;
  }
  .ledger-head .panel-title {
    margin-top: -4px;
  }
  .mobile-date {
    font-size: 11px;
  }
  .amount {
    font-size: 13px;
  }
  .expense-name {
    gap: 9px;
    min-height: 42px;
  }
  .summary,
  .breakdown,
  .recurring,
  .annual {
    padding: 18px;
  }
  .currency {
    min-height: 39px;
  }
  .budget .icon-btn {
    width: 42px;
    height: 42px;
  }
  #mobile {
    display: flex;
    position: fixed;
    z-index: 2;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--panel);
    border-top: 1px solid var(--line);
    justify-content: space-around;
    padding: 5px 4px max(5px, env(safe-area-inset-bottom));
  }
  #mobile .navitem {
    min-width: 55px;
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    border-radius: 8px;
    padding: 6px 9px;
  }
  #mobile .navitem svg {
    width: 19px;
    height: 19px;
  }
  #toast {
    bottom: 72px;
  }
  .rule-row {
    gap: 7px;
    flex-wrap: wrap;
  }
  .dialog-content {
    padding: 17px;
  }
  .dialog-head {
    padding: 13px 17px;
  }
  .fields {
    gap: 8px;
  }
  .top-tools .icon-btn {
    min-width: 40px;
  }
  .quick,
  .text-btn,
  .choice-grid button {
    min-height: 40px;
  }
  .dialog-actions .btn {
    min-height: 44px;
  }
  .annual-chart {
    gap: 1%;
  }
  .annual-chart button {
    font-size: 9px;
  }
}
.wide-money {
  font-size: clamp(28px, 2.8vw, 43px);
}
.hero:has(.wide-money) .hero-art {
  opacity: 0.25;
}
@media (max-width: 760px) {
  .mode-btn {
    min-height: 40px;
    white-space: nowrap;
    gap: 5px;
  }
  .top-inner {
    gap: 6px;
  }
  .top-tools .icon-btn {
    min-height: 44px;
  }
  .wide-money {
    font-size: clamp(23px, 5.5vw, 34px);
    letter-spacing: -1.3px;
  }
  .fields .field input,
  .fields .field select,
  .field > input,
  .field > select,
  .field > textarea {
    font-size: 16px;
  }
  .cat-pair > span {
    overflow-wrap: anywhere;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
