@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  font-family:
    'DM Sans',
    system-ui,
    -apple-system,
    sans-serif;
  color: #182744;
  background: #f5f8fe;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  /* Allow rapid taps throughout the app while retaining scrolling and pinch zoom. */
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
}

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

input[type='number'] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

button {
  cursor: pointer;
}

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

.sidebar {
  width: 250px;
  background: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  border-right: 1px solid #eaf0f9;
  padding: 32px 19px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -1.8px;
  padding: 0 12px;
  color: #132647;
}

.brand-icon {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  background: transparent;
  border-radius: 25%;
  overflow: hidden;
}

.brand-icon img {
  /* Crop past the PNG's padded, uneven outline; the container supplies one curve. */
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  max-width: none;
  object-fit: cover;
  display: block;
}

.brand-dot {
  color: #3479fb;
}

.side-caption,
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.8px;
  font-weight: 800;
  color: #98a6bd;
}

.side-caption {
  padding: 37px 15px 13px;
}

.sidebar nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  border-radius: 12px;
  color: #71809a;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  width: 100%;
}

.nav-item.active {
  background: #eaf2ff;
  color: #2163e8;
}

.nav-item .nav-icon {
  font-size: 19px;
  width: 22px;
  text-align: center;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #eef1f7;
  padding: 22px 8px 0;
  font-size: 13px;
}

.sidebar-foot small {
  display: block;
  color: #99a6bb;
  margin-top: 3px;
}

.avatar {
  background: #eaf2ff;
  color: #2563eb;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.shell {
  margin-left: 250px;
  min-height: 100vh;
}

.topbar {
  padding: 31px 46px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar h1 {
  font:
    800 29px 'Plus Jakarta Sans',
    sans-serif;
  letter-spacing: -1.1px;
  margin: 6px 0 0;
}

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

.offline {
  background: #eaf9f2;
  color: #218a62;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 20px;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #22c987;
  border-radius: 50%;
  margin-right: 5px;
}

.icon-btn {
  border: 1px solid #e8edf6;
  background: #fff;
  border-radius: 12px;
  width: 38px;
  height: 38px;
  color: #526888;
}

.mobile-brand {
  display: none;
}

main {
  max-width: 1370px;
  padding: 0 46px 65px;
  margin: auto;
}

.welcome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 7px 0 24px;
}

.welcome h2 {
  font:
    800 20px 'Plus Jakarta Sans',
    sans-serif;
  margin: 0 0 6px;
}

.muted {
  color: #8a9ab1;
  font-size: 13px;
}

.btn {
  border: 0;
  background: #2465ed;
  color: #fff;
  padding: 12px 19px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 6px 15px #2465ed25;
}

.btn:hover {
  background: #1755d8;
}

.btn.secondary {
  background: #edf3ff;
  color: #2563eb;
  box-shadow: none;
}

.btn.ghost {
  background: #fff;
  border: 1px solid #e2eaf5;
  color: #536786;
  box-shadow: none;
}

.btn.danger {
  background: #fff0f1;
  color: #d33e54;
  box-shadow: none;
}

.grid {
  display: grid;
  gap: 20px;
}

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

.balance-card {
  background: linear-gradient(125deg, #1753d8, #3379f5 72%, #5998ff);
  border-radius: 20px;
  padding: 25px 27px;
  color: #fff;
  position: relative;
  overflow: hidden;
  min-height: 185px;
}

.balance-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.balance-privacy-toggle {
  border: 1px solid #ffffff66;
  border-radius: 8px;
  background: #ffffff1a;
  color: #fff;
  padding: 5px 9px;
  font: inherit;
  font-size: 12px;
}

.balance-privacy-toggle:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.balance-value-blurred {
  display: inline-block;
  filter: blur(9px);
  user-select: none;
  -webkit-user-select: none;
}

.balance-card:after {
  content: '';
  position: absolute;
  width: 210px;
  height: 210px;
  border: 1px solid #ffffff30;
  border-radius: 50%;
  right: -60px;
  top: -80px;
  box-shadow:
    0 0 0 35px #ffffff0b,
    0 0 0 70px #ffffff09;
}

.balance-card > * {
  position: relative;
  z-index: 1;
}

.balance-card p {
  margin: 0;
  font-size: 13px;
  color: #dbe9ff;
}

.balance-card h2 {
  font:
    800 36px 'Plus Jakarta Sans',
    sans-serif;
  letter-spacing: -1.3px;
  margin: 15px 0 21px;
  overflow-wrap: anywhere;
}

.balance-card footer {
  font-size: 12px;
  color: #e2edff;
}

.stat-card,
.panel {
  background: #fff;
  border: 1px solid #e9eff8;
  border-radius: 20px;
  padding: 23px;
  box-shadow: 0 7px 25px #203a6510;
}

.stat-card .label {
  font-size: 13px;
  color: #8494aa;
  font-weight: 600;
}

.stat-card .stat-value {
  font:
    800 26px 'Plus Jakarta Sans',
    sans-serif;
  letter-spacing: -0.9px;
  margin: 22px 0 15px;
  overflow-wrap: anywhere;
}

.stat-card .stat-bottom {
  font-size: 12px;
  color: #93a1b5;
}

.stat-icon {
  float: right;
  border-radius: 12px;
  padding: 8px;
  background: #eaf9f2;
  color: #16a16e;
  font-size: 18px;
}

.expense-icon {
  background: #fff0f1;
  color: #f15b70;
}

.section-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 19px;
}

.panel-head h3 {
  font:
    800 16px 'Plus Jakarta Sans',
    sans-serif;
  margin: 0;
}

.link-btn {
  border: 0;
  background: none;
  color: #2869eb;
  font-weight: 800;
  font-size: 12px;
}

.empty {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  min-height: 180px;
  text-align: center;
  color: #9aabc1;
}

.empty-icon {
  background: #f0f5ff;
  color: #6698f5;
  font-size: 30px;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  margin-bottom: 13px;
}

.empty b {
  color: #526681;
  font-size: 14px;
}

.empty p {
  font-size: 12px;
  margin: 7px 0 0;
}

.transaction {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid #f0f3f9;
}

.transaction:last-child {
  border: 0;
}

.tx-icon {
  background: #eff5ff;
  color: #3072eb;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

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

.tx-main b {
  align-items: center;
  display: flex;
  gap: 7px;
  font-size: 13px;
  white-space: nowrap;
}

.tx-main b > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-main small {
  color: #98a6bb;
  font-size: 11px;
  white-space: pre-line;
}

.tx-note-badge {
  background: #eef4ff;
  border: 1px solid #dbe8ff;
  border-radius: 999px;
  color: #3479f4;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  padding: 4px 7px;
}

.tx-note-badge.open {
  background: #3479f4;
  border-color: #3479f4;
  color: #fff;
}

.tx-note-badge:hover {
  background: #dceaff;
  border-color: #94bdff;
  box-shadow: 0 0 0 3px #e7f0ff;
  color: #174ea6;
  transform: translateY(-1px);
}

.tx-note-badge.open:hover {
  background: #1f5fd6;
  border-color: #1f5fd6;
  color: #fff;
}

.tx-note-badge:focus {
  outline: 2px solid #94bdff;
  outline-offset: 2px;
}

.tx-split-badge {
  background: #f3efff;
  border-color: #e3d8ff;
  color: #7750bb;
}

.tx-split-badge.open {
  background: #7750bb;
  border-color: #7750bb;
  color: #fff;
}

.tx-split-badge:hover {
  background: #ece4ff;
  border-color: #b99be8;
  box-shadow: 0 0 0 3px #f3efff;
  color: #603c9b;
}

.tx-split-badge.open:hover {
  background: #603c9b;
  border-color: #603c9b;
  color: #fff;
}

.tx-split-badge:focus {
  outline-color: #b99be8;
}

.tx-note-popover {
  background: #f8fbff;
  border: 1px solid #dbe8ff;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(52, 121, 244, 0.1);
  color: #253754;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 7px;
  max-width: min(420px, 72vw);
  padding: 10px 12px;
  white-space: pre-wrap;
  width: fit-content;
}

.tx-split-details {
  width: 100%;
  max-width: 420px;
  white-space: normal;
}

.tx-split-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 6px 0;
}

.tx-split-line + .tx-split-line {
  border-top: 1px solid #e1e9f4;
}

.tx-split-line > span:first-child {
  overflow-wrap: anywhere;
}

.tx-split-amount {
  white-space: nowrap;
  font-weight: 800;
}

.tx-amount {
  font-weight: 800;
  font-size: 13px;
}

.income {
  color: #1ea878;
}

.expense {
  color: #ed6175;
}

.transfer {
  color: #4c7ce9;
}

.tx-actions {
  display: flex;
  gap: 3px;
}

.mini-btn {
  background: #f4f7fc;
  border: 0;
  border-radius: 8px;
  padding: 6px;
  color: #7890ae;
}

.chart-wrap {
  display: flex;
  align-items: center;
  gap: 25px;
  justify-content: center;
  min-height: 200px;
}

.donut {
  width: 175px;
  height: 175px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(#e9eff8 0 100%);
  flex-shrink: 0;
}

.donut-hole {
  width: 119px;
  height: 119px;
  background: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
}

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

.donut-hole small {
  font-size: 10px;
  color: #9caabe;
}

.legend {
  flex: 1;
}

.legend-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
  font-size: 12px;
}

.legend-item span:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.quick-action {
  border: 1px solid #e9eff8;
  border-radius: 14px;
  background: #fff;
  padding: 17px 10px;
  text-align: center;
  font-weight: 800;
  color: #425a7c;
  font-size: 12px;
}

.quick-action span {
  display: block;
  font-size: 22px;
  margin-bottom: 8px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.toolbar h2 {
  font: 800 20px 'Plus Jakarta Sans';
  margin: 0;
}

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

.search-panel {
  background: #fff;
  border: 1px solid #e7eef8;
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.08);
  margin-bottom: 18px;
  padding: 16px;
}

.search-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.search-panel-head h3 {
  font: 800 16px 'Plus Jakarta Sans';
  margin: 0 0 3px;
}

.search-panel-head p {
  color: #64748b;
  font-size: 13px;
  margin: 0;
}

.search-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(120px, 0.6fr));
  gap: 10px;
  margin-bottom: 14px;
}

.search-field {
  display: grid;
  gap: 5px;
  min-width: min(100%, 280px);
  color: #53647e;
  font-size: 11px;
  font-weight: 800;
}

.search-field input,
.search-field select {
  background: #fff;
  border: 1px solid #e1e9f4;
  border-radius: 11px;
  color: #253754;
  font-size: 16px;
  height: 50px;
  outline: none;
  padding: 12px;
  width: 100%;
  box-sizing: border-box;
}

.search-period {
  min-width: 150px;
}

.search-field select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23526888' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 42px;
}

.search-field input:focus,
.search-field select:focus {
  border-color: #4381f5;
  box-shadow: 0 0 0 3px #e7f0ff;
}

.category-filter {
  display: grid;
  gap: 9px;
}

.category-filter > span {
  color: #53647e;
  font-size: 11px;
  font-weight: 800;
}

.category-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.category-filter-groups {
  display: grid;
  gap: 13px;
}

.category-filter-group {
  background: #f8fbff;
  border: 1px solid #e7eef8;
  border-radius: 14px;
  overflow: hidden;
}

.category-filter-group.open {
  padding-bottom: 12px;
}

.category-group-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: #253754;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 12px;
  text-align: left;
  width: 100%;
}

.category-group-toggle span {
  font-size: 12px;
  font-weight: 900;
}

.category-group-toggle small {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.category-group-toggle b {
  align-items: center;
  background: #fff;
  border: 1px solid #dbe7f5;
  border-radius: 50%;
  color: #3479f4;
  display: inline-flex;
  font-size: 16px;
  height: 28px;
  justify-content: center;
  line-height: 1;
  width: 28px;
}

.category-filter-group .category-filter-options {
  padding: 0 12px;
}

.category-check {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  gap: 7px;
  min-height: 38px;
  opacity: 0.58;
  padding: 7px 12px 7px 8px;
}

.category-filter-item {
  display: grid;
  gap: 7px;
}

.category-main {
  align-items: center;
  display: flex;
  gap: 5px;
}

.category-expand {
  background: #fff;
  border: 1px solid #dbe7f5;
  border-radius: 50%;
  color: #3479f4;
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
  height: 30px;
  line-height: 1;
  width: 30px;
}

.category-expand.open {
  background: #edf5ff;
  border-color: #86b7ff;
}

.subcategory-options {
  border-left: 2px solid #dbeafe;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-left: 14px;
  padding-left: 8px;
}

.category-check.subcategory {
  background: #fff;
  border-style: dashed;
  font-weight: 700;
}

.category-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.category-check span {
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  color: #94a3b8;
  display: inline-flex;
  filter: grayscale(1);
  height: 24px;
  justify-content: center;
  width: 24px;
}

.category-check.selected {
  background: #fff;
  border-color: var(--category-color);
  box-shadow: 0 0 0 3px #e7f0ff;
  color: #174ea6;
  opacity: 1;
}

.category-check.selected span {
  background: #fff;
  border-color: var(--category-color);
  color: var(--category-color);
  filter: none;
}

.account-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
}

.account-picker[hidden] {
  display: none;
}

.account-picker-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 12px;
  border: 1px solid #e1e9f4;
  border-radius: 11px;
  background: #fff;
  color: #253754;
  font: inherit;
  font-size: 16px;
  line-height: 1.25;
  box-sizing: border-box;
  outline: none;
  cursor: pointer;
}

.account-picker-toggle > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.account-picker-toggle[aria-expanded='true'] {
  margin-bottom: 8px;
}

.category-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.category-picker[hidden],
.category-picker-children[hidden] {
  display: none;
}

.category-picker-group {
  min-width: 0;
}

.category-picker-group:has(> .category-picker-children:not([hidden])) {
  grid-column: 1 / -1;
}

.category-picker-parent {
  display: flex;
  gap: 4px;
}

.category-choice,
.category-expand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #e1e9f4;
  border-radius: 9px;
  background: #fff;
  color: #253754;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.category-choice {
  flex: 1;
  text-align: left;
  overflow-wrap: anywhere;
}

.category-choice[aria-pressed='true'] {
  background: #edf4ff;
  border-color: #2568ee;
  color: #174ea6;
}

.category-choice:focus-visible,
.category-expand:focus-visible {
  outline: 3px solid #2568ee;
  outline-offset: 2px;
}

.category-expand {
  flex: 0 0 36px;
}

.category-expand[aria-expanded='true'] svg {
  transform: rotate(180deg);
}

.category-picker-children {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
  gap: 6px;
  margin: 6px 0 0 10px;
  padding-left: 7px;
  border-left: 2px solid #e7f0ff;
}

.category-picker-children > .category-choice:only-child {
  justify-self: start;
  width: 130px;
  max-width: 100%;
  box-sizing: border-box;
}

.account-choice {
  aspect-ratio: 1;
  min-width: 0;
  min-height: 72px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: #fff;
  border: 1px solid #e1e9f4;
  border-radius: 10px;
  color: #253754;
  font: inherit;
  cursor: pointer;
}

.account-choice:hover {
  border-color: #2568ee;
}

.account-choice[aria-pressed='true'] {
  background: #edf4ff;
  border-color: #2568ee;
  color: #174ea6;
  box-shadow: inset 0 0 0 1px #2568ee;
}

.account-choice:focus-visible {
  outline: 3px solid #2568ee;
  outline-offset: 2px;
}

.account-choice-name {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.account-choice small {
  font-size: 10px;
}

.select,
.field input,
.field select,
.field textarea {
  background: #fff;
  border: 1px solid #e1e9f4;
  border-radius: 11px;
  padding: 12px;
  color: #253754;
  outline: none;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 16px;
  line-height: 1.25;
}

.select,
.field input:not([type='checkbox']):not([type='radio']),
.field select,
.field textarea {
  -webkit-appearance: none;
  appearance: none;
}

.select,
.field input:not([type='checkbox']):not([type='radio']),
.field select {
  height: 50px;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.field input[type='checkbox'],
.field input[type='radio'] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  padding: 0;
  margin: 0 8px 0 0;
  vertical-align: -3px;
  accent-color: #2568ee;
}

.select,
.field select {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field input[type='date'],
.field input[type='time'],
.field input[type='datetime-local'] {
  min-height: 50px;
  text-align: left;
}

.field input[type='date']::-webkit-date-and-time-value,
.field input[type='time']::-webkit-date-and-time-value,
.field input[type='datetime-local']::-webkit-date-and-time-value {
  text-align: left;
}

.select {
  width: auto;
  max-width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.account-picker-toggle:focus,
.account-picker-toggle[aria-expanded='true'] {
  border-color: #4381f5;
  box-shadow: 0 0 0 3px #e7f0ff;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
}

#split-container {
  gap: 15px;
}

.field label {
  font-size: 12px;
  font-weight: 800;
  color: #53647e;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.split-row {
  align-items: start;
  row-gap: 7px;
  margin-bottom: 15px;
}

.split-row > .field {
  display: contents;
}

.split-row > .field:first-child > label {
  grid-column: 1;
  grid-row: 1;
}

.split-row > .field:first-child > .account-picker-toggle {
  grid-column: 1;
  grid-row: 2;
}

.split-row > .field:last-child > label {
  grid-column: 2;
  grid-row: 1;
}

.split-row > .field:last-child > .split-amount {
  grid-column: 2;
  grid-row: 2;
}

.split-row > .field > .category-picker {
  grid-column: 1 / -1;
  grid-row: 3;
}

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

.account-card {
  padding: 22px;
  border: 1px solid #e7eef8;
  border-radius: 17px;
  background: #fff;
}

.account-card .account-symbol {
  font-size: 22px;
  background: #eaf2ff;
  color: #2d6ef0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  margin-bottom: 17px;
}

.account-card h3 {
  font-size: 14px;
  margin: 0 0 8px;
}

.account-card strong {
  font: 800 22px 'Plus Jakarta Sans';
}

.account-card p {
  color: #9cabc0;
  font-size: 12px;
}

.account-card .actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.account-sections {
  display: grid;
  gap: 18px;
}

.account-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-group {
  background: #fff;
  border: 1px solid #e9eff8;
  border-radius: 16px;
  overflow: hidden;
}

.account-group-head {
  align-items: center;
  background: #f8fbff;
  border-bottom: 1px solid #eef3fb;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
}

.account-group-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.account-group-controls > span {
  margin-right: 4px;
}

.account-group-controls .mini-btn {
  min-width: 28px;
  min-height: 28px;
}

.account-group-controls .mini-btn:disabled,
.account-actions [data-move-account]:disabled {
  opacity: 0.35;
  cursor: default;
}

.account-group-head h3 {
  color: #253754;
  font-size: 13px;
  margin: 0;
}

.account-group-head span {
  color: #8da0bb;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.account-list {
  padding: 0 16px;
}

.account-row {
  align-items: center;
  border-bottom: 1px solid #f0f3f9;
  display: flex;
  gap: 12px;
  min-height: 68px;
  padding: 12px 0;
}

.account-hidden-badge,
.account-archived-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 5px;
  background: #edf4ff;
  color: #2d6be6;
  font-size: 9px;
  line-height: 12px;
  font-weight: 700;
}

.account-hidden-badge-placeholder {
  visibility: hidden;
}

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

.account-row > strong {
  color: #253754;
  font-size: 13px;
  font-weight: 900;
  margin-left: auto;
  white-space: nowrap;
}

.account-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.account-visibility,
.account-archive-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
}

.account-visibility:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.account-visibility[aria-pressed='true'] {
  color: #2568ee;
}

.account-visibility:focus-visible,
.account-archive-button:focus-visible {
  outline: 3px solid #2568ee;
  outline-offset: 2px;
}

.mini-btn.danger {
  background: #fff1f3;
  color: #d94f64;
}

.account-archive {
  margin-top: 30px;
}

.account-archive > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid #d8e5f8;
  border-radius: 12px;
  background: #edf4ff;
  color: #2568ce;
  font-size: 14px;
  font-weight: 700;
}

.account-archive > summary::-webkit-details-marker {
  display: none;
}

.account-archive > summary::before {
  content: '›';
  flex: 0 0 16px;
  text-align: center;
  font-size: 24px;
  line-height: 1;
}

.account-archive[open] > summary::before {
  transform: rotate(90deg);
}

.account-archive > summary:hover {
  background: #e3eeff;
  border-color: #aac8f5;
}

.account-archive-label {
  display: grid;
  gap: 3px;
}

.account-archive-label small {
  font-size: 11px;
  font-weight: 500;
  color: #526b94;
}

.account-archive-collapse,
.account-archive[open] .account-archive-expand {
  display: none;
}

.account-archive[open] .account-archive-collapse {
  display: inline;
}

.account-archive > summary:focus-visible {
  outline: 3px solid #2568ee;
  outline-offset: 2px;
  border-radius: 6px;
}

.account-archive[open] > .account-sections {
  margin-top: 12px;
}

.table-list {
  background: #fff;
  border: 1px solid #e9eff8;
  border-radius: 18px;
  padding: 10px 22px;
}

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

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

.category-group-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
}

.category-group-head > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.category-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.category-item .tx-main b {
  white-space: normal;
  overflow-wrap: anywhere;
}

.category-group-head h3 {
  margin: 0;
  font:
    800 16px 'Plus Jakarta Sans',
    sans-serif;
  color: #233653;
}

.category-group-head p {
  margin: 4px 0 0;
  color: #8c9bb2;
  font-size: 12px;
  line-height: 1.4;
}

.category-item + .category-item {
  border-top: 1px solid #f0f3f9;
}

.category-item .transaction {
  border-bottom: 0;
}

.subcategory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 0 12px 52px;
}

.subcategory-chip {
  background: #f4f8ff;
  border: 1px solid #e5edf8;
  border-radius: 999px;
  color: #526681;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.inline-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-field input {
  flex: 1;
}

.pill {
  display: inline-block;
  background: #edf4ff;
  color: #2d6be6;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 800;
}

.progress {
  height: 9px;
  background: #edf2fa;
  border-radius: 20px;
  overflow: hidden;
  margin: 13px 0 8px;
}

.progress span {
  display: block;
  height: 100%;
  background: #2c70f0;
  border-radius: 20px;
}

.budget-row {
  padding: 15px 0;
  border-bottom: 1px solid #edf1f7;
}

.budget-row:last-child {
  border: 0;
}

.budget-row .head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #11213c88;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}

.modal {
  background: #fff;
  border-radius: 22px;
  width: min(100%, 540px);
  max-height: min(92dvh, 850px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px #10244855;
}

.modal h2 {
  font: 800 20px 'Plus Jakarta Sans';
  margin: 0;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 20px 25px 16px;
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #eef3fa;
}

.modal-head h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.modal-body {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 25px 25px;
  min-height: 0;
  overscroll-behavior: contain;
}

.modal-body:has(> form > .modal-footer:last-child),
.modal-body:has(> .modal-footer:last-child) {
  padding-bottom: 0;
}

.modal-body > form {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.close {
  border: 0;
  background: #f1f5fb;
  color: #61758e;
  border-radius: 9px;
  width: 32px;
  height: 32px;
  font-size: 20px;
  flex: 0 0 auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
  background: #fff;
  padding: 14px 0 18px;
  z-index: 2;
}

.modal-footer .btn.danger:first-child {
  margin-right: auto;
}

.segmented {
  display: flex;
  background: #f1f5fb;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 18px;
}

.segmented button {
  flex: 1;
  border: 0;
  border-radius: 9px;
  background: transparent;
  padding: 11px 3px;
  font-size: 12px;
  font-weight: 800;
  color: #8da0ba;
}

.segmented button.active {
  background: #fff;
  color: #2465eb;
  box-shadow: 0 2px 8px #233b6517;
}

.notice {
  padding: 13px;
  border-radius: 12px;
  background: #edf5ff;
  color: #4e6b94;
  font-size: 12px;
  line-height: 1.6;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.settings-tile {
  padding: 20px;
  border: 1px solid #e8eff8;
  border-radius: 15px;
  background: #fff;
}

.settings-tile h3 {
  margin: 0 0 9px;
  font-size: 15px;
}

.settings-tile p {
  color: #8e9eb5;
  font-size: 12px;
  line-height: 1.6;
  min-height: 40px;
}

.toast {
  position: fixed;
  bottom: 90px;
  right: 25px;
  background: #18385f;
  color: #fff;
  padding: 13px 20px;
  border-radius: 12px;
  z-index: 60;
  box-shadow: 0 10px 30px #13274633;
  font-size: 13px;
}

.bottom-nav {
  display: none;
}

.form-hint {
  font-size: 11px;
  color: #92a0b5;
}

.conversion-preview {
  margin: -3px 0 14px;
}

.rate-list {
  border: 1px solid #e4ecf7;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 12px;
  background: #fff;
}

.rate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #edf2fa;
  font-size: 12px;
}

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

.rate-row label {
  display: grid;
  gap: 2px;
  min-width: 72px;
}

.rate-row span {
  color: #53647e;
  font-weight: 800;
}

.rate-row small {
  color: #92a0b5;
  font-weight: 700;
}

.rate-input {
  flex: 1;
  min-width: 0;
  /* Smaller text causes iPhone browsers to zoom when the field receives focus. */
  font-size: 16px;
  border: 1px solid #e1e9f4;
  border-radius: 9px;
  padding: 9px 10px;
  color: #253754;
  outline: none;
}

.rate-input:focus {
  border-color: #4381f5;
  box-shadow: 0 0 0 3px #e7f0ff;
}

.rate-row b {
  color: #253754;
  text-align: right;
}

.rate-actions {
  margin-top: 12px;
}

.payee-autocomplete {
  position: relative;
}

.payee-suggestions {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 190px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dce7f5;
  border-radius: 11px;
  box-shadow: 0 14px 35px #16325f20;
  padding: 6px;
}

.payee-suggestions button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #253754;
  text-align: left;
  padding: 10px 11px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.payee-suggestions button:hover,
.payee-suggestions button:focus {
  background: #edf4ff;
  color: #2465eb;
}

.mobile-only {
  display: none;
}

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

  .balance-card {
    grid-column: span 2;
  }

  .section-grid {
    grid-template-columns: 1fr;
  }

  .account-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 750px) {
  .sidebar {
    display: none;
  }

  .shell {
    margin: 0;
  }

  .topbar {
    padding: 19px 20px 15px;
  }

  .top-left .eyebrow {
    display: none;
  }

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

  .mobile-brand {
    display: flex;
    font-size: 22px;
    padding: 0;
  }

  .mobile-brand .brand-icon {
    width: 31px;
    height: 31px;
  }

  .top-left {
    display: none;
  }

  .offline {
    display: none;
  }

  main {
    padding: 12px 17px 105px;
  }

  .welcome {
    margin: 8px 0 18px;
  }

  .welcome h2 {
    font-size: 19px;
  }

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

  .balance-card {
    padding: 23px;
    min-height: 175px;
  }

  .balance-card h2 {
    font-size: 32px;
  }

  .stat-card {
    padding: 17px;
  }

  .stat-card .stat-value {
    font-size: 20px;
    margin: 15px 0;
  }

  .stat-card .label {
    font-size: 11px;
  }

  .stat-card .stat-bottom {
    font-size: 10px;
  }

  .stat-icon {
    font-size: 14px;
    padding: 5px;
  }

  .section-grid {
    gap: 13px;
    margin-top: 13px;
  }

  .search-panel {
    border-radius: 16px;
    padding: 14px;
  }

  .search-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-grid {
    grid-template-columns: 1fr;
  }

  .search-field {
    min-width: 100%;
  }

  .panel {
    padding: 19px;
  }

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

  .account-group-head {
    padding: 12px 13px;
  }

  .account-list {
    padding: 0 13px;
  }

  .account-row {
    align-items: flex-start;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 0;
  }

  .account-row > strong {
    grid-column: 3;
    grid-row: 1;
    margin-left: 0;
    align-self: center;
  }

  .account-actions {
    grid-column: 2 / 4;
    flex-wrap: wrap;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e8eef8;
    z-index: 15;
    padding: 8px 6px calc(9px + env(safe-area-inset-bottom));
    justify-content: space-around;
    box-shadow: 0 -8px 25px #1e427009;
  }

  .bottom-nav button {
    background: none;
    border: 0;
    color: #9aabc2;
    display: grid;
    place-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 700;
    min-width: 57px;
  }

  .bottom-nav button.active {
    color: #2568ee;
  }

  .bottom-nav button span {
    font-size: 21px;
  }

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

  .modal {
    width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 94dvh;
  }

  .modal-head {
    padding: 16px 19px 13px;
  }

  .modal-body {
    padding: 15px 19px calc(19px + env(safe-area-inset-bottom));
  }

  .modal-body:has(> form > .modal-footer:last-child),
  .modal-body:has(> .modal-footer:last-child) {
    padding-bottom: 0;
  }

  .modal-footer {
    padding: 12px 19px calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid #eef3fa;
  }

  .chart-wrap {
    gap: 12px;
  }

  .donut {
    width: 135px;
    height: 135px;
  }

  .donut-hole {
    width: 92px;
    height: 92px;
  }

  .donut-hole strong {
    font-size: 13px;
  }

  .legend-item {
    font-size: 11px;
  }

  .toolbar {
    align-items: flex-start;
  }

  .toolbar h2 {
    font-size: 17px;
  }

  .category-group-head {
    align-items: flex-start;
  }

  .category-group-head .btn {
    flex: 0 0 auto;
  }

  .category-group > .table-list {
    padding: 0 12px;
  }

  .category-item .transaction {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .category-item .tx-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 16px;
  }

  .category-actions {
    grid-column: 3;
    grid-row: 1;
    flex-wrap: nowrap;
    gap: 3px;
  }

  .category-actions .mini-btn {
    width: 28px;
    min-width: 28px;
    height: 32px;
    padding: 0;
    font-size: 14px;
  }

  .subcategory-list {
    padding-left: 0;
  }

  .field-row {
    gap: 9px;
  }

  .mobile-only {
    display: block;
  }
}

@media (max-width: 380px) {
  .welcome h2 {
    font-size: 16px;
  }

  .btn {
    padding: 11px 12px;
  }

  .balance-card h2 {
    font-size: 27px;
  }

  .stat-card .stat-value {
    font-size: 17px;
  }

  .chart-wrap {
    flex-direction: column;
  }

  .legend {
    width: 100%;
  }
}

.select,
.field input,
.field select {
  padding-right: 18px;
}

.select,
.field select,
.account-picker-toggle {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23526888' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 42px;
}

.field input::-webkit-calendar-picker-indicator {
  margin-right: 3px;
}

.field input[type='color'] {
  padding-right: 12px;
}

.accounts-nav-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.settings-version {
  margin: 0;
  padding: 20px 0 calc(25px + env(safe-area-inset-bottom, 0px));
  color: #71809a;
  font-size: 12px;
  text-align: center;
}
