* {
  box-sizing: border-box;
}

:root {
  --green-950: #153624;
  --green-900: #1b422d;
  --green-800: #24543a;
  --green-700: #34734d;
  --green-100: #e9f2ec;
  --green-50: #f3f8f4;
  --ink: #1e2922;
  --muted: #849087;
  --line: #edf0ed;
  --surface: #ffffff;
  --page: #f7f9f7;
  --red: #d96d69;
  --red-soft: #fff0ef;
  --shadow: 0 8px 28px rgba(28, 55, 38, 0.045);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }

.sidebar {
  width: 248px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 30px 20px 22px;
  display: flex;
  flex-direction: column;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--green-950);
  margin: 0 0 52px 5px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border-radius: 12px;
  background: var(--green-900);
  color: white;
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  font-size: 19px;
}

.brand-name {
  font-family: "Manrope", sans-serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.8px;
}

.brand-name span { color: var(--green-700); font-weight: 600; }

.sidebar-label {
  color: #a0aaa2;
  font-size: 10px;
  letter-spacing: 1.4px;
  font-weight: 700;
  margin: 0 0 14px 12px;
}

.side-nav { display: grid; gap: 7px; }

.nav-item {
  border: 0;
  background: transparent;
  color: #758078;
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  width: 100%;
  padding: 12px 13px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  transition: background .18s ease, color .18s ease;
}

.nav-item:hover { background: #f5f8f5; color: var(--green-800); }
.nav-item.active { color: var(--green-900); background: var(--green-100); }
.nav-icon { width: 18px; text-align: center; font-size: 18px; line-height: 1; }

.sidebar-bottom { margin-top: auto; }
.sidebar-note {
  margin: 24px 4px 0;
  padding: 15px 12px;
  border-radius: 11px;
  background: #f6f8f6;
  color: #8a958d;
  font-size: 11px;
  line-height: 1.6;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.note-dot { width: 7px; height: 7px; border-radius: 50%; background: #6caa7e; margin-top: 5px; flex: 0 0 auto; }

.main-content {
  margin-left: 248px;
  max-width: 1600px;
  padding: 37px 42px 24px;
}

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

.eyebrow {
  margin: 0 0 7px;
  color: var(--green-700);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.8px;
}

h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 6px;
  font-family: "Manrope", sans-serif;
  font-size: 27px;
  line-height: 1.25;
  letter-spacing: -1px;
}
.welcome-text { margin: 0; color: var(--muted); font-size: 12px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; padding-top: 8px; }
.month-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--line);
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--green-800);
  font-size: 12px;
}
.month-picker input {
  border: 0;
  outline: 0;
  color: #59645c;
  background: transparent;
  font-size: 12px;
  min-width: 118px;
}
.icon-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--green-800);
  width: 37px;
  height: 37px;
  border-radius: 9px;
  font-size: 21px;
}
.icon-button:hover { background: var(--green-50); }
.avatar {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border-radius: 50%;
  background: #e7efe9;
  color: var(--green-800);
  font-size: 11px;
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr 1fr;
  gap: 15px;
  margin-bottom: 19px;
}

.summary-card, .panel {
  background: var(--surface);
  border: 1px solid #eff2ef;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.summary-card { min-height: 142px; padding: 19px 19px 17px; }
.balance-card {
  background: var(--green-900);
  color: white;
  border-color: var(--green-900);
  position: relative;
  overflow: hidden;
}
.balance-card::after {
  content: "";
  position: absolute;
  width: 145px;
  height: 145px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 50%;
  right: -45px;
  top: 40px;
  box-shadow: 0 0 0 18px rgba(255,255,255,.025), 0 0 0 38px rgba(255,255,255,.02);
}
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-label { color: #87928a; font-size: 11px; font-weight: 600; }
.balance-card .card-label { color: #c3d4c8; }
.card-symbol { color: #c4d9cb; font-size: 17px; }
.balance-amount {
  margin: 18px 0 12px;
  font-family: "Manrope", sans-serif;
  font-size: clamp(21px, 2.2vw, 29px);
  letter-spacing: -1.1px;
  font-weight: 800;
  position: relative;
  z-index: 1;
  overflow-wrap: anywhere;
}
.balance-foot { display: flex; align-items: center; gap: 7px; color: #c3d4c8; font-size: 10px; }
.balance-indicator { width: 6px; height: 6px; background: #8dc59c; border-radius: 50%; }
.metric-icon {
  width: 27px;
  height: 27px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
}
.income-icon { background: #eaf5ed; color: #43865a; }
.expense-icon { background: var(--red-soft); color: var(--red); }
.ending-icon { background: #f1f2ed; color: #777f5c; }
.metric-amount {
  margin: 20px 0 7px;
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  font-size: clamp(16px, 1.7vw, 21px);
  letter-spacing: -.6px;
  overflow-wrap: anywhere;
}
.metric-caption { color: #a0a9a2; font-size: 10px; }

.content-grid {
  display: grid;
  grid-template-columns: 1.12fr 1fr;
  gap: 17px;
  margin-bottom: 18px;
}
.panel { padding: 21px 21px 19px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-heading h2 {
  margin: 0 0 5px;
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  letter-spacing: -.3px;
}
.panel-heading p { margin: 0; color: #9aa39c; font-size: 10px; }
.panel-menu { color: #a4ada6; letter-spacing: 2px; font-size: 14px; }
.text-button {
  border: 0;
  background: transparent;
  color: var(--green-700);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 0;
  white-space: nowrap;
}
.text-button:hover { color: var(--green-950); }

.chart-content {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 20px;
  min-height: 205px;
  padding: 12px 3px 0;
}
.donut-wrap { flex: 0 0 auto; }
.donut {
  width: 174px;
  height: 174px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(#e8eee9 0deg 360deg);
  position: relative;
}
.donut::before {
  content: "";
  position: absolute;
  inset: 17px;
  background: white;
  border-radius: 50%;
}
.donut-center { position: relative; display: grid; gap: 5px; text-align: center; max-width: 125px; }
.donut-center span { color: #9ba49d; font-size: 9px; }
.donut-center strong {
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  letter-spacing: -.5px;
  overflow-wrap: anywhere;
}
.chart-legend { flex: 1; display: grid; gap: 12px; min-width: 0; }
.legend-item { display: grid; grid-template-columns: 8px minmax(0,1fr) auto; align-items: center; gap: 8px; font-size: 10px; }
.legend-dot { width: 7px; height: 7px; border-radius: 3px; }
.legend-name { color: #7e8981; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-value { color: #39453d; font-weight: 700; white-space: nowrap; }
.empty-chart { color: #a0aaa2; font-size: 10px; line-height: 1.6; }

.budget-total { display: flex; justify-content: space-between; gap: 10px; margin: 21px 0 11px; }
.budget-total > div { display: grid; gap: 5px; }
.budget-total-right { text-align: right; }
.subtle-label { color: #9ba49d; font-size: 9px; }
.budget-total strong { font-family: "Manrope", sans-serif; font-size: 16px; letter-spacing: -.4px; }
.overall-progress { width: 100%; height: 6px; background: #edf1ed; border-radius: 10px; overflow: hidden; margin-bottom: 17px; }
.overall-progress span { display: block; width: 0; height: 100%; background: #57936a; border-radius: inherit; transition: width .3s ease; }
.budget-list { display: grid; gap: 12px; }
.budget-row { display: grid; gap: 6px; }
.budget-row-top { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; }
.budget-category { color: #647067; font-weight: 600; }
.budget-amount { color: #89938b; white-space: nowrap; }
.budget-track { height: 5px; background: #f0f2f0; border-radius: 8px; overflow: hidden; }
.budget-fill { height: 100%; background: #79a987; border-radius: inherit; }
.budget-fill.over { background: #d97972; }
.budget-percent { color: #a1aaa3; font-size: 9px; text-align: right; }
.empty-state { color: #a0aaa2; font-size: 10px; padding: 8px 0; }

.transactions-panel { padding-bottom: 7px; }
.transaction-heading { margin-bottom: 18px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
thead th {
  color: #a1aaa3;
  font-size: 9px;
  letter-spacing: .8px;
  font-weight: 700;
  text-align: left;
  padding: 11px 10px;
  background: #fafbfa;
}
thead th:first-child { padding-left: 12px; border-radius: 7px 0 0 7px; }
thead th:last-child { border-radius: 0 7px 7px 0; }
tbody td { border-bottom: 1px solid #f1f3f1; padding: 13px 10px; font-size: 10px; color: #7b867e; }
tbody tr:last-child td { border-bottom: 0; }
.transaction-name { display: flex; align-items: center; gap: 10px; color: #39453d; font-weight: 700; }
.transaction-bullet { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; background: #f0f5f1; color: #548364; font-size: 12px; }
.transaction-bullet.expense { background: #fff1f0; color: #d97972; }
.type-pill { display: inline-flex; padding: 4px 7px; border-radius: 5px; font-size: 9px; background: #edf5ef; color: #568364; }
.type-pill.expense { background: #fff0ef; color: #cb716b; }
.amount-cell { text-align: right; font-weight: 700; color: #38443c; white-space: nowrap; }
.amount-cell.income { color: #4c8a60; }
.amount-heading { text-align: right; }
.table-empty { text-align: center; color: #a0aaa2; padding: 28px 10px; }
.footer { display: flex; justify-content: space-between; gap: 12px; color: #a5ada7; font-size: 9px; padding: 20px 2px 0; }

.error-banner {
  background: #fff3f2;
  border: 1px solid #f4d9d7;
  color: #984f4a;
  border-radius: 10px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 17px;
}
.error-banner strong { font-size: 11px; }
.error-banner p { margin: 4px 0 0; font-size: 10px; color: #ad6a65; }
.retry-button { border: 0; background: #fff; border-radius: 7px; padding: 8px 11px; color: #a6534d; font-size: 10px; font-weight: 700; }
.hidden { display: none !important; }
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 15px);
  opacity: 0;
  pointer-events: none;
  background: #203d2b;
  color: white;
  padding: 10px 15px;
  border-radius: 9px;
  font-size: 11px;
  box-shadow: 0 8px 25px rgba(0,0,0,.15);
  transition: .2s ease;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mobile-nav { display: none; }

@media (max-width: 1150px) {
  .main-content { padding-left: 28px; padding-right: 28px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .chart-content { justify-content: flex-start; gap: 45px; }
}

@media (max-width: 700px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 24px 16px 94px; }
  .topbar { display: block; margin-bottom: 21px; }
  h1 { font-size: 24px; }
  .topbar-actions { padding-top: 17px; }
  .month-picker { flex: 1; }
  .month-picker input { width: 100%; }
  .avatar { margin-left: auto; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .summary-card { min-height: 126px; padding: 14px; border-radius: 12px; }
  .balance-card { grid-column: 1 / -1; min-height: 137px; }
  .balance-amount { font-size: 27px; margin: 16px 0 10px; }
  .metric-amount { font-size: 17px; margin-top: 17px; }
  .card-label { font-size: 10px; }
  .metric-caption { font-size: 9px; line-height: 1.4; }
  .content-grid { gap: 12px; }
  .panel { padding: 17px 14px; border-radius: 12px; }
  .panel-heading h2 { font-size: 13px; }
  .chart-content { min-height: auto; gap: 15px; padding-top: 19px; }
  .donut { width: 135px; height: 135px; }
  .donut::before { inset: 13px; }
  .donut-center { max-width: 105px; }
  .donut-center strong { font-size: 12px; }
  .chart-legend { gap: 10px; }
  .legend-item { grid-template-columns: 7px minmax(0,1fr); gap: 6px; }
  .legend-value { grid-column: 2; font-size: 9px; }
  .legend-name { font-size: 9px; }
  .budget-total strong { font-size: 14px; }
  .transaction-heading { align-items: center; }
  .footer { padding-bottom: 4px; font-size: 8px; }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    inset: auto 0 0;
    z-index: 10;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid #edf0ed;
    padding: 8px 5px max(8px, env(safe-area-inset-bottom));
  }
  .mobile-nav-item {
    border: 0;
    background: transparent;
    color: #929d94;
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 4px 0;
  }
  .mobile-nav-item span { font-size: 19px; line-height: 1; }
  .mobile-nav-item small { font-size: 8px; font-weight: 600; }
  .mobile-nav-item.active { color: var(--green-800); }
  .error-banner { align-items: flex-start; }
}

@media (max-width: 360px) {
  .main-content { padding-left: 12px; padding-right: 12px; }
  .summary-card { padding: 12px; }
  .chart-content { gap: 9px; }
  .donut { width: 118px; height: 118px; }
  .donut::before { inset: 11px; }
  .legend-value { white-space: normal; }
}


/* Transaction page */
.page-view.hidden { display: none !important; }
.page-topbar { margin-bottom: 22px; }
.transaction-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(220px, .8fr); gap: 18px; align-items: start; }
.transaction-form-panel { padding: 25px; }
.form-section-heading { margin-bottom: 23px; }
.form-section-heading h2 { margin: 0 0 5px; font-family: "Manrope", sans-serif; font-size: 16px; }
.form-section-heading p { margin: 0; color: #9aa39c; font-size: 11px; }
.form-field { display: grid; gap: 8px; margin-bottom: 19px; }
.form-field > label { color: #566259; font-size: 11px; font-weight: 700; }
.required-mark { color: #d97972; }
.type-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-option { display: flex; align-items: center; gap: 11px; padding: 13px; border: 1px solid #e9eeea; border-radius: 10px; background: #fff; color: #6e7a71; text-align: left; }
.type-option.active { border-color: #6b9a78; background: #f3f8f4; box-shadow: 0 0 0 2px rgba(84,132,98,.08); }
.type-option strong, .type-option small { display: block; }
.type-option strong { color: #35443a; font-size: 11px; margin-bottom: 3px; }
.type-option small { color: #9aa39c; font-size: 9px; }
.type-option-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; font-size: 17px; font-weight: 700; }
.expense-option-icon { background: #fff0ef; color: #d97972; }
.income-option-icon { background: #eaf5ed; color: #4b8b60; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-control { width: 100%; min-height: 43px; border: 1px solid #e6ebe7; border-radius: 8px; padding: 10px 12px; outline: none; color: #35443a; background: #fff; font-size: 11px; }
.form-control:focus { border-color: #79a987; box-shadow: 0 0 0 3px rgba(92,145,105,.1); }
.form-control::placeholder { color: #b0b8b2; }
.field-hint { color: #a1aaa3; font-size: 9px; }
.upload-placeholder { display: flex; align-items: center; gap: 11px; border: 1px dashed #dce5de; border-radius: 9px; padding: 13px; background: #fbfcfb; }
.upload-placeholder-icon { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; background: #edf4ef; color: #568364; font-size: 20px; }
.upload-placeholder strong, .upload-placeholder small { display: block; }
.upload-placeholder strong { color: #647067; font-size: 10px; margin-bottom: 4px; }
.upload-placeholder small { color: #a0aaa2; font-size: 9px; line-height: 1.5; }
.coming-soon { margin-left: auto; color: #8a978e; background: #f0f3f0; padding: 5px 7px; border-radius: 5px; font-size: 8px; white-space: nowrap; }
.form-note { display: flex; gap: 9px; padding: 11px 12px; border-radius: 8px; background: #f5f8f5; color: #789080; margin: 5px 0 20px; }
.form-note > span { font-size: 13px; }
.form-note p { margin: 0; font-size: 9px; line-height: 1.6; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; }
.primary-button, .secondary-button { min-height: 40px; border-radius: 8px; padding: 0 16px; font-size: 10px; font-weight: 700; }
.primary-button { border: 1px solid var(--green-900); background: var(--green-900); color: #fff; }
.primary-button:hover { background: var(--green-800); }
.primary-button:disabled { opacity: .6; cursor: wait; }
.primary-button span { margin-left: 8px; }
.secondary-button { border: 1px solid #e7ece8; background: #fff; color: #758078; }
.transaction-side-info { display: grid; gap: 13px; }
.tip-panel { padding: 20px; }
.tip-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #eef5ef; color: #568364; font-size: 17px; margin-bottom: 14px; }
.tip-panel h3 { margin: 0 0 7px; font-family: "Manrope", sans-serif; font-size: 12px; }
.tip-panel p { margin: 0; color: #929d94; font-size: 10px; line-height: 1.7; }
.transaction-summary-card { padding: 18px; display: grid; gap: 8px; }
.transaction-summary-card strong { font-family: "Manrope", sans-serif; color: var(--green-900); font-size: 17px; }
.transaction-summary-card p { margin: 0; color: #929d94; font-size: 10px; line-height: 1.5; }
@media (max-width: 900px) { .transaction-layout { grid-template-columns: 1fr; } .transaction-side-info { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .transaction-form-panel { padding: 18px 14px; } .form-row { grid-template-columns: 1fr; gap: 0; } .transaction-side-info { grid-template-columns: 1fr; } .type-option { padding: 10px; } .coming-soon { display: none; } .form-actions { display: grid; grid-template-columns: .7fr 1.3fr; } .primary-button, .secondary-button { padding: 0 10px; } }
