:root {
  color-scheme: light;
  --navy-950: #061d31;
  --navy-900: #092a45;
  --navy-800: #123d5c;
  --teal-600: #008f7f;
  --teal-500: #0bb7a6;
  --teal-100: #dff5f1;
  --ink: #162d3c;
  --muted: #61727d;
  --line: #dbe4e7;
  --surface: #ffffff;
  --canvas: #f3f7f8;
  --danger: #b63c45;
  --shadow: 0 18px 60px rgba(7, 37, 59, 0.08);
  font-family: Inter, Aptos, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(11, 183, 166, 0.35);
  outline-offset: 3px;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  width: 244px;
  flex-direction: column;
  padding: 32px 20px 24px;
  background: var(--navy-900);
  color: white;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 36px;
  color: white;
  font-size: 1.23rem;
  font-weight: 800;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 42px;
  height: 42px;
}

.brand strong { color: var(--teal-500); }

.nav-list { display: grid; gap: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #c9d7df;
  font-weight: 650;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: white; }
.nav-item:active { transform: translateY(1px); }
.nav-item.is-active { background: rgba(11, 183, 166, 0.18); color: white; }

.nav-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 9px;
  color: var(--teal-500);
  font-size: 13px;
  font-weight: 800;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.privacy-note strong,
.privacy-note span { display: block; }
.privacy-note strong { font-size: 14px; }
.privacy-note span { margin-top: 2px; color: #b9cad4; font-size: 12px; }
.status-dot { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--teal-500); box-shadow: 0 0 0 4px rgba(11, 183, 166, 0.14); }

.main-content { min-height: 100vh; margin-left: 244px; padding: 30px clamp(24px, 4vw, 64px) 64px; }

.topbar,
.page-heading,
.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.topbar { margin: 0 auto 28px; max-width: 1280px; }
.topbar h1 { margin: 2px 0 0; color: var(--navy-900); font-size: clamp(1.65rem, 2vw, 2.15rem); line-height: 1.2; }
.topbar-actions { display: flex; gap: 10px; }

.eyebrow {
  margin: 0;
  color: var(--teal-600);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 750;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--teal-600); color: white; box-shadow: 0 8px 24px rgba(0, 143, 127, 0.2); }
.button-primary:hover { background: #007e71; }
.button-secondary { border-color: var(--line); background: white; color: var(--navy-900); }
.button-secondary:hover { background: #f8fbfb; }

.view { display: none; max-width: 1280px; margin: 0 auto; animation: view-in 240ms ease both; }
.view.is-active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.85fr); gap: 20px; }
.balance-panel,
.spending-panel,
.surface {
  border: 1px solid rgba(13, 61, 91, 0.08);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.balance-panel,
.spending-panel { min-height: 352px; padding: 28px; }
.section-heading-row { align-items: flex-start; }
.section-heading-row h2 { margin: 4px 0 0; color: var(--navy-900); font-size: 1.4rem; line-height: 1.2; }
.balance-panel .section-heading-row h2 { font-size: clamp(2.1rem, 4vw, 3rem); letter-spacing: -0.04em; }
.change-positive { padding: 7px 10px; border-radius: 999px; background: var(--teal-100); color: #08766a; font-size: 0.8rem; font-weight: 800; }

.account-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 30px; }
.account-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #fbfdfd; }
.account-bank { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.bank-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--account-color); }
.account-card strong { display: block; overflow: hidden; color: var(--navy-900); font-size: 1.1rem; text-overflow: ellipsis; white-space: nowrap; }
.account-card span:last-child { color: var(--muted); font-size: 0.75rem; }

.text-button,
.icon-button {
  border: 0;
  background: transparent;
  color: var(--teal-600);
  font-weight: 800;
}
.text-button { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; padding: 5px 0; }
.text-button span { display: grid; width: 25px; height: 25px; place-items: center; border: 1px solid #addfd8; border-radius: 50%; }
.text-button.compact { margin-top: 0; font-size: 0.84rem; }
.icon-button { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: var(--teal-100); font-size: 1.1rem; }

.spending-content { display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 24px; margin-top: 35px; }
.donut { display: grid; width: 170px; aspect-ratio: 1; place-items: center; border-radius: 50%; background: conic-gradient(var(--teal-600) 0 35%, #2c607a 35% 66%, #f0aa4d 66% 82%, #cf6f79 82% 93%, #a8bbc4 93%); }
.donut::before { content: ""; grid-area: 1 / 1; width: 71%; aspect-ratio: 1; border-radius: 50%; background: white; }
.donut-centre { z-index: 1; grid-area: 1 / 1; text-align: center; }
.donut-centre span { display: block; color: var(--muted); font-size: 0.72rem; }
.donut-centre strong { display: block; margin-top: 3px; color: var(--navy-900); font-size: 1rem; }
.category-legend { display: grid; gap: 10px; }
.category-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; font-size: 0.82rem; }
.category-row i { width: 8px; height: 8px; border-radius: 50%; background: var(--category-color); }
.category-row span { color: var(--muted); }
.category-row strong { color: var(--navy-900); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr); gap: 20px; margin-top: 20px; }
.surface { padding: 24px; }
.transaction-list { margin-top: 18px; }
.transaction-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(100px, 0.7fr) auto; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid #e7edef; }
.transaction-main { display: flex; min-width: 0; align-items: center; gap: 12px; }
.transaction-icon { display: grid; flex: 0 0 auto; width: 38px; height: 38px; place-items: center; border-radius: 11px; background: var(--category-bg); color: var(--category-color); font-weight: 850; }
.transaction-main strong,
.transaction-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transaction-main span,
.transaction-category { color: var(--muted); font-size: 0.8rem; }
.transaction-amount { color: var(--navy-900); font-weight: 800; text-align: right; }
.budget-list { display: grid; gap: 19px; margin-top: 24px; }
.budget-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; font-size: 0.84rem; }
.budget-head strong { color: var(--navy-900); }
.budget-head span { color: var(--muted); }
.progress { height: 8px; overflow: hidden; border-radius: 999px; background: #e7edef; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--progress-color, var(--teal-600)); }

.page-heading { margin-bottom: 22px; align-items: flex-end; }
.page-heading h2 { margin: 4px 0 0; color: var(--navy-900); font-size: 2rem; }
.page-note { max-width: 480px; margin: 0; color: var(--muted); text-align: right; }
.filter-label { display: grid; gap: 5px; color: var(--muted); font-size: 0.78rem; font-weight: 750; }
select,
input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #cbd8dc; border-radius: 10px; background: white; color: var(--ink); }
.expense-table { padding: 8px 24px 18px; }
.table-header,
.expense-table .transaction-row { grid-template-columns: minmax(220px, 1.6fr) minmax(130px, 0.7fr) minmax(150px, 0.8fr) minmax(100px, 0.45fr); }
.table-header { display: grid; gap: 14px; padding: 14px 0 11px; color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.expense-table .transaction-row { padding: 16px 0; }
.expense-table .transaction-category { font-size: 0.9rem; }
.account-label { color: var(--muted); font-size: 0.88rem; }

.budget-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.budget-card { min-height: 245px; padding: 24px; border: 1px solid rgba(13, 61, 91, 0.08); border-radius: 20px; background: white; box-shadow: var(--shadow); }
.budget-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.budget-card h3 { margin: 0; color: var(--navy-900); font-size: 1.2rem; }
.budget-percentage { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 50%; background: var(--teal-100); color: var(--teal-600); font-size: 0.8rem; font-weight: 850; }
.budget-values { margin: 38px 0 12px; }
.budget-values strong { color: var(--navy-900); font-size: 1.65rem; }
.budget-values span { color: var(--muted); }
.budget-card .progress { height: 10px; }
.budget-remaining { margin: 12px 0 0; color: var(--muted); font-size: 0.82rem; }

.dialog { width: min(520px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 28px 90px rgba(5, 29, 49, 0.28); }
.dialog::backdrop { background: rgba(5, 29, 49, 0.62); backdrop-filter: blur(4px); }
.dialog form { display: grid; gap: 18px; padding: 28px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-heading h2 { margin: 4px 0 0; color: var(--navy-900); }
.dialog-close { border: 0; background: transparent; color: var(--muted); font-size: 1.8rem; line-height: 1; }
.dialog label { display: grid; gap: 6px; color: var(--navy-900); font-size: 0.86rem; font-weight: 750; }
.dialog-copy { margin: 0; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: min(390px, calc(100% - 48px)); padding: 13px 16px; border-radius: 12px; background: var(--navy-950); color: white; box-shadow: var(--shadow); opacity: 0; transform: translateY(15px); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast.is-visible { opacity: 1; transform: none; }

@media (max-width: 1080px) {
  .overview-grid,
  .detail-grid { grid-template-columns: 1fr; }
  .spending-panel { min-height: auto; }
  .spending-content { grid-template-columns: 200px 1fr; }
  .donut { width: 200px; }
  .budget-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .sidebar { position: sticky; top: 0; width: 100%; height: auto; flex-direction: row; align-items: center; padding: 12px 16px; }
  .brand { flex: 0 0 auto; padding: 0; }
  .brand img { width: 36px; height: 36px; }
  .brand span { display: none; }
  .nav-list { display: flex; margin-left: auto; gap: 3px; }
  .nav-item { width: auto; padding: 9px; font-size: 0; }
  .nav-mark { width: 34px; height: 34px; font-size: 13px; }
  .privacy-note { display: none; }
  .main-content { margin-left: 0; padding: 22px 16px 48px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-direction: column-reverse; }
  .button { padding-inline: 13px; }
  .account-list { grid-template-columns: 1fr; }
  .spending-content { grid-template-columns: 1fr; justify-items: center; }
  .category-legend { width: min(320px, 100%); }
  .transaction-row { grid-template-columns: minmax(0, 1fr) auto; }
  .transaction-category { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-note { text-align: left; }
  .filter-label { width: 100%; }
  .table-header { display: none; }
  .expense-table .transaction-row { grid-template-columns: minmax(0, 1fr) auto; }
  .expense-table .account-label,
  .expense-table .transaction-category { display: none; }
  .budget-cards { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .topbar { flex-direction: column; }
  .topbar-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .topbar-actions .button { font-size: 0.84rem; }
  .balance-panel,
  .spending-panel,
  .surface { padding: 20px; border-radius: 17px; }
  .change-positive { max-width: 150px; text-align: right; }
  .form-row { grid-template-columns: 1fr; }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
}
