:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --app: #ffffff;
  --card: #ffffff;
  --soft: #f7faf8;
  --ink: #151a22;
  --muted: #6f7883;
  --line: #e6ebe8;
  --green: #23bf83;
  --green-dark: #179b68;
  --blue: #3a82e4;
  --orange: #ff8b2c;
  --pink: #ee5a86;
  --shadow: 0 12px 34px rgba(18, 28, 24, 0.08);
  --deep-shadow: 0 20px 50px rgba(18, 28, 24, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(35, 191, 131, 0.48);
  outline-offset: 2px;
}

.app-shell {
  width: min(100%, 470px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 12px 16px 96px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.98)),
    var(--app);
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  font-size: 1.78rem;
  font-weight: 900;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
}

h3 {
  margin: 0;
}

.month-control {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 38px;
}

.month-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e6ebe8;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 5px 14px rgba(18, 28, 24, 0.035);
  pointer-events: none;
  gap: 7px;
  min-width: 118px;
  min-height: 36px;
  border-radius: 999px;
  padding: 0 14px;
}

.month-calendar-icon {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  align-self: center;
  background: #313941;
  transform: translateY(3px);
  -webkit-mask: url("assets/icon-calendar.svg") center / contain no-repeat;
  mask: url("assets/icon-calendar.svg") center / contain no-repeat;
}

.month-pill strong {
  color: #242b33;
  font-size: 0.86rem;
  font-weight: 780;
  line-height: 1;
  white-space: nowrap;
}

.chevron {
  display: grid;
  place-items: center;
  color: #111820;
  font-size: 0.78rem;
  line-height: 1;
  transform: translateY(-.2px);
}

.month-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.month-control:focus-within .month-pill,
.month-control:hover .month-pill {
  border-color: rgba(35, 191, 131, 0.45);
  box-shadow: 0 10px 22px rgba(35, 191, 131, 0.12);
}

.hero-card {
  position: relative;
  min-height: 132px;
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid #ccefe3;
  border-radius: 18px;
  padding: 24px 20px;
  background:
    radial-gradient(circle at 78% 42%, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0) 34%),
    linear-gradient(135deg, #f2fff9 0%, #dbfaee 100%);
  box-shadow: 0 12px 28px rgba(35, 191, 131, 0.12);
}

.hero-card::before,
.hero-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -42px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 50%;
}

.hero-card::after {
  right: -2px;
  top: 10px;
  width: 156px;
  height: 156px;
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: 58%;
  transform: translateY(8px);
}

.hero-copy > span {
  display: block;
  color: #174839;
  font-size: 0.94rem;
  font-weight: 650;
}

.hero-copy > strong {
  display: block;
  margin-top: 13px;
  color: var(--green-dark);
  font-size: 3.05rem;
  font-weight: 950;
  line-height: 0.94;
  letter-spacing: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.total-budget-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  margin-top: 13px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.total-budget-link strong {
  color: var(--muted);
  font-weight: 800;
}

.total-budget-link:hover,
.total-budget-link:focus-visible {
  color: var(--green-dark);
  outline: none;
}

.total-budget-link:hover strong,
.total-budget-link:focus-visible strong {
  color: var(--green-dark);
}

.hero-art {
  position: absolute;
  right: -38px;
  bottom: -22px;
  z-index: 0;
  width: 58%;
  max-width: 275px;
  height: 128%;
  object-fit: cover;
  object-position: right bottom;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.55) 22%, #000 42%);
  mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.55) 22%, #000 42%);
}

.card-section,
.account-row,
.transaction-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.card-section {
  margin-top: 12px;
  padding: 14px;
}

.monthly-result-section {
  margin-top: 16px;
}

.monthly-result-section .section-head {
  padding: 0 4px;
}

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

.overview-card {
  min-width: 0;
  min-height: 158px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 18px 17px;
  background:
    radial-gradient(circle at 18% 13%, rgba(255, 255, 255, 0.78), transparent 38%),
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(247, 250, 248, 0.94));
  box-shadow: 0 10px 24px rgba(42, 33, 22, 0.06);
}

.overview-card h3 {
  color: #65717c;
  font-size: 0.86rem;
  font-weight: 850;
  line-height: 1.2;
}

.overview-card.asset-change-result {
  border-color: var(--line);
}

.overview-card > strong {
  display: block;
  margin-top: 14px;
  color: var(--green-dark);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.cash-balance-button {
  display: block;
  margin-top: 8px;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
}

.cash-balance-button strong {
  display: block;
  color: var(--green-dark);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.cash-balance-button strong.is-negative {
  color: var(--green-dark);
}

.cash-calibration-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.cash-calibration-row > span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.cash-calibration-row[hidden] {
  display: none;
}

.cash-calibration-row .secondary-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.74rem;
}

.overview-card > strong.is-negative { color: var(--green-dark); }
.overview-breakdown b.is-negative { color: #4d5964; }

.overview-divider {
  height: 1px;
  margin: 18px 0 14px;
  background: var(--line);
}

.overview-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.overview-breakdown span {
  min-width: 0;
}

.overview-breakdown em,
.overview-breakdown b {
  display: block;
  line-height: 1.18;
}

.overview-breakdown em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 750;
}

.overview-breakdown b {
  margin-top: 4px;
  color: #4d5964;
  font-size: 0.8rem;
  font-weight: 850;
  white-space: nowrap;
}

.overview-cash-input {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
  min-width: 0;
  color: #4d5964;
  font-size: 0.8rem;
  font-weight: 850;
}

.overview-cash-input span {
  margin: 0;
  color: inherit;
  font-size: inherit;
}

.overview-cash-input input {
  width: 100%;
  min-width: 0;
  min-height: 22px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.overview-cash-input input:focus {
  border-bottom-color: color-mix(in srgb, var(--green) 34%, var(--line));
  outline: none;
}

.result-equation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr) 22px minmax(0, 1.1fr);
  gap: 6px;
  align-items: center;
}

.result-card {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 7px;
  background: #fff;
}

.result-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #eef5ed;
  color: var(--green-dark);
  font-size: 1.05rem;
  font-weight: 900;
}

.investment-result .result-icon {
  background: #eef5ed;
}

.asset-change-result {
  border-color: rgba(35, 191, 131, 0.46);
}

.asset-change-result .result-icon {
  background: linear-gradient(145deg, #6edca5, #25ba7b);
  color: #fff;
}

.result-label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: #51606b;
  font-size: 0.68rem;
  line-height: 1.2;
}

.result-card strong {
  display: block;
  margin-top: 4px;
  color: #176a4f;
  font-size: 0.98rem;
  line-height: 1;
  white-space: nowrap;
}

.result-card strong.is-negative,
.account-metrics b.is-negative {
  color: #4d5964;
}

.account-metrics b.is-positive {
  color: #df392f;
}

.info-button {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  min-width: 15px;
  border: 1px solid #9aa6af;
  border-radius: 50%;
  padding: 0;
  background: #fff;
  color: #65717c;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
}

.info-button.is-active {
  border-color: var(--green);
  background: #e8fbf2;
  color: var(--green-dark);
}

.result-operator {
  color: #26343d;
  font-size: 1.22rem;
  font-weight: 900;
  text-align: center;
}

.result-info-tray {
  display: grid;
  gap: 7px;
  margin: 12px 12px 0;
}

.result-info-tray[hidden] {
  display: none;
}

.result-info-tray p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #51606b;
  font-size: 0.78rem;
  line-height: 1.35;
}

.formula-leaf {
  width: 14px;
  height: 14px;
  border: 1.8px solid #73b684;
  border-radius: 100% 0 100% 100%;
  transform: rotate(-28deg);
}

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

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
}

.style-section {
  display: grid;
  gap: 12px;
}

.style-section .section-head {
  margin-bottom: 0;
}

.style-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.style-chart-card,
.style-options-card {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.style-chart-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 202px;
  padding: 0;
  min-width: 0;
}

.style-options-card {
  display: flex;
}

.style-chart-stack {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0;
  min-width: 0;
  min-height: 202px;
}

.style-select {
  width: 128px;
  min-width: 128px;
  min-height: 46px;
  border-color: #d8e4d1;
  border-radius: 16px;
  padding: 8px 38px 8px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 253, 248, 0.98));
  color: #193528;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(34, 55, 43, 0.04);
}

.chart-wrap {
  position: relative;
  width: min(100%, 196px);
  aspect-ratio: 1;
}

.pie-chart {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: transparent;
}

.account-donut {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-center {
  position: absolute;
  inset: 45px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background: #fffdf8;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(233, 224, 210, 0.92), 0 1px 2px rgba(76, 64, 42, 0.08);
}

.chart-center span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.chart-center strong {
  margin-top: 5px;
  color: #193528;
  font-size: 1.16rem;
  font-weight: 950;
}

.legend-list {
  display: grid;
  align-content: center;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.legend-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 76px;
  gap: 8px;
  align-items: center;
  min-height: 46px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(221, 227, 214, 0.9);
}

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

.legend-copy {
  min-width: 0;
}

.legend-row strong,
.legend-row em {
  display: block;
}

.legend-row strong {
  color: #193528;
  font-size: 0.86rem;
  font-weight: 900;
  white-space: nowrap;
}

.legend-row em {
  margin-top: 3px;
  color: #718072;
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 750;
}

.legend-row b {
  font-size: 0.72rem;
  white-space: nowrap;
  text-align: right;
}

.legend-budget-field {
  display: flex;
  align-items: center;
  justify-self: end;
  justify-content: flex-end;
  width: 76px;
  min-width: 0;
}

.legend-budget-field span {
  display: block;
  margin: 0 2px 0 0;
  color: #193528;
  font-size: 0.94rem;
  font-weight: 950;
  line-height: 1;
}

.legend-budget-field input {
  width: 58px;
  min-height: 32px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  padding: 0 0 0 2px;
  background: transparent;
  color: #193528;
  font-size: 0.94rem;
  font-weight: 950;
  text-align: right;
}

.legend-budget-field input:focus {
  border-bottom-color: var(--green);
  color: var(--green-dark);
  outline: none;
}

.legend-budget-field.is-from-breakdown {
  opacity: 0.68;
}

.legend-budget-field input.breakdown-driven {
  color: var(--muted);
  cursor: default;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.42), 0 2px 4px rgba(33, 42, 34, 0.12);
}

.style-options {
  display: grid;
  width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: inherit;
  background: transparent;
}

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

.style-option {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 19px;
  gap: 6px;
  align-items: center;
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.budget-style-picker .style-option {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
}

.style-option:last-child {
  border-bottom: 0;
}

.budget-style-picker .style-option:last-child {
  border-bottom: 1px solid var(--line);
}

.style-option.is-active {
  border-color: rgba(35, 191, 131, 0.44);
  background: #f3fbf6;
}

.budget-style-picker .style-option.is-active:last-child {
  border-bottom-color: rgba(35, 191, 131, 0.44);
}

.style-icon {
  display: grid;
  place-items: center;
  color: var(--green-dark);
  font-size: 1.18rem;
  font-weight: 900;
  line-height: 1;
}

.style-option:nth-child(2) .style-icon {
  color: var(--blue);
}

.style-option:nth-child(3) .style-icon {
  color: var(--orange);
}

.style-option strong {
  min-width: 0;
  font-size: 0.86rem;
  white-space: nowrap;
}

.style-option em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1.2;
}

.style-radio {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid #c6cbc8;
  border-radius: 50%;
  color: transparent;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
}

.style-option.is-active .style-radio {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.accounts-section {
  margin-top: 18px;
}

.account-list {
  display: grid;
  gap: 0;
}

.account-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 98px 60px;
  gap: 12px;
  align-items: center;
  min-height: 92px;
  padding: 12px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.account-row:hover,
.account-row:focus-visible {
  background: color-mix(in srgb, var(--accent) 5%, #ffffff);
  outline: none;
}

.account-row + .account-row {
  margin-top: -1px;
}

.account-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-weight: 900;
  box-shadow: none;
}

.account-icon img,
.account-tab-icon img,
.ledger-entry-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.account-main {
  min-width: 0;
}

.account-main h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 1rem;
  line-height: 1.15;
}

.account-main h3 em {
  border-radius: 6px;
  padding: 2px 7px;
  background: color-mix(in srgb, var(--accent) 14%, #ffffff);
  color: var(--accent);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 750;
}

.account-main p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.32;
}

.account-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-self: center;
  justify-items: end;
  text-align: right;
}

.account-metrics span {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding-left: 9px;
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.18;
}

.account-metrics span:first-child {
  border-left: 0;
  padding-left: 0;
}

.account-metrics b {
  display: block;
  margin-top: 3px;
  color: #121a22;
  font-size: 0.82rem;
  white-space: nowrap;
}

.asset-account-row {
  grid-template-columns: 52px minmax(0, 1fr) 98px 60px;
  background:
    linear-gradient(90deg, rgba(140, 103, 183, 0.08), rgba(58, 130, 228, 0.035) 58%, rgba(255, 255, 255, 0.96)),
    var(--card);
  border-color: rgba(140, 103, 183, 0.18);
}

.asset-metrics {
  gap: 8px;
}

.asset-metrics span {
  padding-left: 9px;
  font-size: 0.68rem;
}

.asset-metrics b {
  font-size: 0.82rem;
}

.account-progress {
  display: grid;
  place-items: center;
  justify-self: end;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0deg var(--progress), #f0eee9 var(--progress) 360deg);
}

.account-progress span {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border-radius: 50%;
  background: #fff;
  color: #172027;
  font-size: 0.82rem;
  font-weight: 750;
}

.secondary-screen {
  padding-top: 44px;
}

.simple-header {
  display: grid;
  gap: 12px;
  justify-items: start;
  margin-bottom: 16px;
}

.ledger-screen {
  --ledger-ink: #263035;
  --ledger-muted: #7b858a;
  --ledger-paper: #fffdf7;
  --ledger-line: #e9e1d7;
  --ledger-soft-green: #eaf5ec;
  min-height: calc(100vh - 108px);
  padding-top: 22px;
  padding-bottom: 14px;
}

.ledger-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
}

.ledger-header h1 {
  color: #24483a;
  font-size: 1.86rem;
  line-height: 1;
}

.ledger-month-control {
  flex: 0 0 auto;
}

.ledger-month-control .month-pill {
  min-width: 136px;
  border-color: #e2e7e4;
  background: rgba(255, 255, 255, 0.96);
}

.ledger-summary-card {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 28px;
  border: 1px solid var(--ledger-line);
  border-radius: 8px;
  padding: 20px 8px 19px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 253, 247, 0.96)),
    var(--ledger-paper);
  box-shadow: 0 12px 26px rgba(54, 46, 34, 0.08);
}

.ledger-summary-card::before {
  content: "";
  position: absolute;
  left: -9px;
  top: -13px;
  width: 54px;
  height: 19px;
  border-radius: 2px;
  background: rgba(164, 188, 143, 0.34);
  transform: rotate(-13deg);
}

.ledger-summary-card div {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 8px;
}

.ledger-summary-card div + div {
  border-left: 1px solid var(--ledger-line);
}

.ledger-summary-card span {
  color: #6f777c;
  font-size: 0.82rem;
  font-weight: 800;
}

.ledger-summary-card strong {
  max-width: 100%;
  color: var(--ledger-ink);
  font-size: clamp(1.06rem, 4.8vw, 1.54rem);
  font-weight: 950;
  line-height: 1.05;
  white-space: nowrap;
}

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

.ledger-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}

.ledger-tabs button,
.ledger-filter-button {
  min-height: 38px;
  border: 1px solid var(--ledger-line);
  border-radius: 8px;
  padding: 0 18px;
  background: rgba(255, 253, 248, 0.9);
  color: #687178;
  font-size: 0.86rem;
  font-weight: 850;
  box-shadow: 0 7px 16px rgba(54, 46, 34, 0.05);
}

.ledger-tabs button.is-active {
  border-color: #2f7252;
  background: linear-gradient(180deg, #438866, #2d6f50);
  color: #fff;
  box-shadow: 0 10px 18px rgba(36, 100, 70, 0.2);
}

.ledger-filter-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding-right: 2px;
}

.ledger-filter-button.is-active {
  border-color: rgba(47, 114, 82, 0.2);
  background: rgba(238, 248, 241, 0.9);
  color: #2f7252;
  padding-right: 10px;
  padding-left: 12px;
}

.ledger-filter-button span {
  color: #3d4850;
  font-size: 1.05rem;
}

.ledger-filter-button.is-active span {
  color: #2f7252;
}

.ledger-filter-button .ledger-filter-label {
  font-size: 0.86rem;
}

.ledger-filter-button b {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #2f7252;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 950;
  line-height: 1;
}

.ledger-filter-button b[hidden] {
  display: none;
}

.ledger-screen .transaction-list {
  gap: 22px;
  margin-top: 20px;
}

.ledger-filter-result {
  margin: 0 8px -8px;
  color: #687178;
  font-size: 0.78rem;
  font-weight: 800;
}

.ledger-day-group {
  display: grid;
  gap: 10px;
}

.ledger-day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
}

.ledger-day-head h2 {
  color: #2f463e;
  font-size: 1.04rem;
  font-weight: 950;
}

.ledger-day-head span {
  color: #7b858a;
  font-size: 0.76rem;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.ledger-day-card {
  overflow: hidden;
  border: 1px solid var(--ledger-line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 10px 22px rgba(54, 46, 34, 0.07);
}

.ledger-swipe-row {
  position: relative;
  overflow: hidden;
  background: var(--ledger-paper);
  --swipe-shift: 0px;
  touch-action: pan-y;
}

.ledger-swipe-row + .ledger-swipe-row .ledger-transaction-row {
  border-top: 1px solid rgba(233, 225, 215, 0.86);
}

.ledger-day-card .ledger-swipe-row:first-child,
.ledger-day-card .ledger-swipe-row:first-child .ledger-transaction-row {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.ledger-day-card .ledger-swipe-row:last-child,
.ledger-day-card .ledger-swipe-row:last-child .ledger-transaction-row {
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.ledger-delete-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 82px;
  border: 0;
  background: #d9534f;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 900;
  z-index: 0;
}

.ledger-day-card .ledger-swipe-row:first-child .ledger-delete-action {
  border-top-right-radius: 8px;
}

.ledger-day-card .ledger-swipe-row:last-child .ledger-delete-action {
  border-bottom-right-radius: 8px;
}

.ledger-transaction-row {
  display: grid;
  position: relative;
  z-index: 1;
  left: 0;
  width: 100%;
  grid-template-columns: 44px minmax(0, 1fr) minmax(82px, auto);
  gap: 12px;
  align-items: center;
  min-height: 72px;
  border: 0;
  border-radius: 0;
  padding: 13px 14px 13px 18px;
  background: var(--ledger-paper);
  box-shadow: none;
  text-align: left;
  transition: transform 180ms ease, padding 180ms ease;
}

.ledger-swipe-row.is-swiping .ledger-transaction-row {
  padding-left: calc(18px + var(--swipe-shift));
  transform: translateX(calc(-1 * var(--swipe-shift)));
}

.ledger-swipe-row.is-delete-open .ledger-transaction-row {
  padding-left: 100px;
  transform: translateX(-82px);
}

.ledger-entry-icon {
  display: grid;
  position: relative;
  left: 0;
  place-items: center;
  width: 38px;
  height: 38px;
  align-self: center;
  border-radius: 10px;
  background: var(--account-soft, var(--ledger-soft-green));
  color: var(--account-color, #2f7252);
  font-size: 1.04rem;
  font-weight: 950;
}

.ledger-entry-main {
  display: grid;
  position: relative;
  left: 0;
  gap: 5px;
  min-width: 0;
}

.ledger-entry-main strong {
  overflow: hidden;
  color: var(--ledger-ink);
  font-size: 0.95rem;
  font-weight: 950;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-entry-main span {
  overflow: hidden;
  color: var(--ledger-muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-amount {
  align-self: center;
  color: var(--ledger-ink);
  font-size: 1.1rem;
  font-weight: 950;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.ledger-empty {
  border: 1px solid var(--ledger-line);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 253, 248, 0.9);
  text-align: center;
}

.back-home-button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 4px;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.back-home-button:hover,
.back-home-button:focus-visible {
  color: var(--green-dark);
}

.transaction-list,
.bar-list,
.ratio-editor {
  display: grid;
  gap: 10px;
}

.transaction-row:not(.ledger-transaction-row) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
}

.transaction-row:not(.ledger-transaction-row) span,
.empty-copy {
  color: var(--muted);
  font-size: 0.78rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: center;
}

.bar-row strong,
.bar-row span {
  font-size: 0.78rem;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1ee;
}

.bar-track div {
  width: var(--bar);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.settings-form {
  display: grid;
  gap: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.account-manager {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

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

.account-manager-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.account-manager-tab {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 5px;
  background: #fff;
  color: #52606a;
  font-size: 0.7rem;
  font-weight: 850;
  line-height: 1.18;
}

.account-manager-tab strong {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.account-manager-tab.is-active {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, #ffffff);
  color: color-mix(in srgb, var(--accent) 72%, #172027);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}

.account-tab-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, #ffffff);
  color: var(--accent);
  font-size: 1rem;
}

.account-tab-icon:has(img),
.ledger-entry-icon:has(img) {
  background: transparent;
}

.account-detail {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--soft) 62%, #ffffff), #ffffff 48%),
    var(--card);
  box-shadow: var(--shadow);
}

.account-detail-head {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}

.account-detail-head h2 {
  color: #172027;
  font-size: 1.02rem;
}

.account-detail-head p,
.account-principle,
.account-submodule p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.account-principle {
  margin-top: 12px;
  border-left: 3px solid var(--accent);
  padding: 9px 10px;
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--soft) 66%, #ffffff);
  color: #3f4a53;
  font-weight: 750;
}

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

.account-detail-metrics span,
.account-detail-metrics .metric-link {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.18;
  text-align: left;
}

.account-detail-metrics b,
.account-detail-metrics .metric-link b {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 0.82rem;
  white-space: nowrap;
}

.me-page {
  display: grid;
  gap: 12px;
}

.me-summary {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 2px 2px 8px;
}

.me-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--green) 12%, #ffffff);
  color: var(--green-dark);
  font-weight: 950;
}

.me-summary h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
}

.me-summary p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.emergency-card {
  overflow: hidden;
  border-color: color-mix(in srgb, var(--green) 28%, var(--line));
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 12px 28px rgba(18, 28, 24, 0.08);
}

.emergency-head {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
}

.emergency-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--green) 11%, #ffffff);
  color: var(--green-dark);
  font-size: 1.28rem;
  font-weight: 950;
}

.emergency-title h2 {
  margin: 0;
  font-size: 1.08rem;
}

.emergency-title p {
  margin: 3px 0 0;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 850;
}

.emergency-card.is-gap .emergency-title p {
  color: var(--pink);
}

.emergency-card .safety-month-control {
  grid-template-columns: auto 1px 38px auto;
  gap: 7px;
  min-height: 36px;
  padding: 4px 9px;
  box-shadow: none;
}

.emergency-card .safety-month-control input {
  width: 38px;
  min-height: 26px;
  font-size: 0.94rem;
}

.emergency-cover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.emergency-cover strong {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--green-dark);
  font-size: 2.28rem;
  font-weight: 950;
  line-height: 1;
}

.emergency-cover strong span {
  font-size: 1.15rem;
}

.emergency-cover em {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-style: normal;
}

.emergency-cover > b {
  color: var(--green-dark);
  font-size: 1.22rem;
  line-height: 1;
  white-space: nowrap;
}

.emergency-card.is-gap .emergency-cover strong,
.emergency-card.is-gap .emergency-cover > b {
  color: var(--pink);
}

.emergency-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  border: 1px solid color-mix(in srgb, var(--green) 14%, var(--line));
  border-radius: 8px;
  padding: 9px 8px;
}

.emergency-metrics span {
  min-width: 0;
  display: grid;
  gap: 4px;
  text-align: center;
}

.emergency-metrics span + span {
  border-left: 1px solid color-mix(in srgb, var(--green) 14%, var(--line));
}

.emergency-metrics em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
}

.emergency-metrics b {
  color: var(--ink);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.emergency-metrics b.is-positive {
  color: var(--green-dark);
}

.emergency-metrics b.is-negative {
  color: #4d5964;
}

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

.backup-actions {
  display: grid;
  gap: 8px;
}

.me-action-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 20px rgba(18, 28, 24, 0.05);
}

.me-action-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--green) 8%, #ffffff);
  color: var(--green-dark);
  font-weight: 900;
}

.me-action-row strong,
.me-action-row em {
  display: block;
}

.me-action-row strong {
  font-size: 0.9rem;
}

.me-action-row em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-style: normal;
}

.me-action-row > b {
  color: var(--muted);
  font-size: 0.82rem;
}

.danger-action .me-action-icon {
  background: #fff1f0;
  color: #c43d31;
}

.budget-allocation-status {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 850;
  line-height: 1.22;
}

.budget-allocation-status.is-gap {
  color: #7b6b3d;
}

.budget-allocation-status.is-over {
  color: #d94738;
}

.account-detail-metrics .metric-link:hover,
.account-detail-metrics .metric-link:focus-visible,
.account-detail-metrics .metric-link.is-active {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, #ffffff);
  color: var(--accent);
  outline: none;
}

.account-detail-metrics .metric-link:hover b,
.account-detail-metrics .metric-link:focus-visible b,
.account-detail-metrics .metric-link.is-active b {
  color: var(--accent);
}

.account-detail-metrics .metric-link.is-active .budget-allocation-status.is-gap {
  color: #856a20;
}

.account-detail-metrics .metric-link.is-active .budget-allocation-status.is-over {
  color: #d94738;
}

.account-tests,
.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.account-detail > .account-tests,
.account-detail > .category-tags,
.account-detail > .account-submodules {
  display: none;
}

.account-tests span,
.category-tags span {
  max-width: 100%;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(255, 255, 255, 0.76);
  color: #3c4851;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.25;
}

.category-tags {
  padding-top: 1px;
}

.category-tags span {
  border-color: transparent;
  background: color-mix(in srgb, var(--accent) 12%, #ffffff);
  color: color-mix(in srgb, var(--accent) 72%, #1e2b34);
}

.account-submodules {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.account-submodule {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.account-submodule h3 {
  color: #202a33;
  font-size: 0.86rem;
  line-height: 1.25;
}

.breakdown-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.budget-breakdown {
  padding: 0;
  position: relative;
  overflow: hidden;
}

.section-swipe-content {
  position: relative;
  z-index: 1;
  background: #fff;
  transition: transform 0.18s ease;
}

.section-swipe-row.is-delete-open .section-swipe-content {
  transform: translateX(-82px);
}

.section-swipe-row.is-swipe-demo .section-swipe-content {
  animation: sectionSwipeDemo 1.35s ease-in-out 1;
}

.section-delete-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 82px;
  border: 0;
  background: #d84a3a;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 850;
  z-index: 0;
}

@keyframes sectionSwipeDemo {
  0%, 100% { transform: translateX(0); }
  36%, 72% { transform: translateX(-82px); }
}

.breakdown-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 34px;
  gap: 8px;
  align-items: center;
  min-height: 72px;
  padding: 10px;
  background: #fff;
}

.section-title-field {
  min-width: 0;
}

.section-title-field input {
  min-height: 34px;
  border-color: transparent;
  padding: 4px 0;
  background: transparent;
  color: #202a33;
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.2;
}

.section-title-field input:focus {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  padding-inline: 8px;
  background: #fff;
}

.section-title-field em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 700;
}

.breakdown-head .breakdown-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 999px;
  padding: 0;
  background: color-mix(in srgb, var(--accent) 9%, #ffffff);
  color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.breakdown-head .breakdown-toggle::before {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.breakdown-head .breakdown-toggle:hover,
.breakdown-head .breakdown-toggle:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent) 14%, #ffffff);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 14%, transparent);
}

.budget-breakdown.is-open .breakdown-head .breakdown-toggle {
  transform: rotate(180deg);
}

.breakdown-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  border: 0;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.breakdown-toggle strong,
.breakdown-toggle em {
  display: block;
}

.breakdown-metrics {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.breakdown-metrics > span {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.breakdown-metrics b {
  display: inline;
  color: color-mix(in srgb, var(--accent) 72%, #152018);
  font-size: 0.76rem;
  font-weight: 800;
}

.breakdown-metrics b.is-overspent {
  color: #d94738;
}

.breakdown-toggle strong {
  color: #202a33;
  font-size: 0.9rem;
  line-height: 1.2;
}

.breakdown-toggle em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 700;
}

.breakdown-toggle b {
  color: color-mix(in srgb, var(--accent) 72%, #152018);
  font-size: 0.92rem;
  white-space: nowrap;
}

.breakdown-toggle i {
  color: var(--muted);
  font-style: normal;
  transition: transform 0.18s ease;
}

.budget-breakdown.is-open .breakdown-toggle i {
  transform: rotate(180deg);
}

.breakdown-panel {
  display: none;
  border-top: 1px solid var(--line);
  padding: 10px;
  background: rgba(255, 255, 255, 0.64);
}

.budget-breakdown.is-open .breakdown-panel {
  display: grid;
  gap: 10px;
}

.breakdown-items {
  display: grid;
  gap: 8px;
}

.breakdown-item,
.breakdown-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 102px 36px;
  gap: 7px;
  align-items: center;
}

.breakdown-item > input,
.breakdown-add-form > input {
  min-height: 38px;
  font-size: 0.82rem;
}

.breakdown-item label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.breakdown-item label span {
  margin: 0;
  padding-left: 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.breakdown-item label input {
  min-height: 36px;
  border: 0;
  padding-left: 4px;
  font-size: 0.82rem;
}

.breakdown-delete {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  color: #b54b40;
}

.breakdown-add-form {
  grid-template-columns: minmax(0, 1fr) 88px 58px;
}

.breakdown-add-form .secondary-button {
  min-height: 38px;
  padding: 0 8px;
  font-size: 0.78rem;
}

.section-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 8px;
  padding: 10px;
  border: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
}

.section-add-form input,
.section-add-form .secondary-button {
  min-height: 38px;
  font-size: 0.78rem;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 80;
  max-width: min(320px, calc(100vw - 40px));
  transform: translateX(-50%);
  border-radius: 999px;
  padding: 10px 14px;
  background: #1f2d28;
  color: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  font-size: 0.82rem;
  font-weight: 750;
  text-align: center;
}

.app-toast[hidden] {
  display: none;
}

.spent-breakdown-items {
  display: grid;
  gap: 8px;
}

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

.spent-breakdown-summary span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.spent-breakdown-summary em,
.spent-breakdown-summary b {
  display: block;
  line-height: 1.2;
}

.spent-breakdown-summary em {
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 750;
}

.spent-breakdown-summary b {
  margin-top: 5px;
  color: color-mix(in srgb, var(--accent) 72%, #152018);
  font-size: 0.88rem;
  font-weight: 900;
  white-space: nowrap;
}

.spent-breakdown-preview {
  display: grid;
  gap: 8px;
}

.spent-breakdown-section-head > strong,
.spent-breakdown-preview > strong {
  color: #4b5963;
  font-size: 0.78rem;
  font-weight: 850;
}

.spent-compact-items {
  display: grid;
}

.spent-compact-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 6px 2px;
  border-bottom: 1px solid var(--line);
}

.spent-compact-item:last-child {
  border-bottom: none;
}

.spent-compact-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.75rem;
}

.spent-compact-item b {
  color: color-mix(in srgb, var(--accent) 72%, #152018);
  font-size: 0.78rem;
  font-weight: 800;
}

.spent-breakdown-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.spent-breakdown-item span {
  min-width: 0;
  color: #4b5963;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.35;
}

.spent-breakdown-item b {
  color: color-mix(in srgb, var(--accent) 72%, #152018);
  font-size: 0.82rem;
  white-space: nowrap;
}

.spent-ledger-link {
  min-height: 40px;
  border: 1px solid rgba(23, 111, 74, 0.28);
  border-radius: 10px;
  background: #f3fbf6;
  color: #176f4a;
  font-size: 0.82rem;
  font-weight: 850;
}

label span,
.form-field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.custom-select {
  position: relative;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.custom-select-trigger > span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-trigger > svg {
  flex-shrink: 0;
  color: #59656d;
  transition: transform 0.15s;
}

.custom-select.is-open .custom-select-trigger {
  border-color: rgba(35, 191, 131, 0.6);
}

.custom-select.is-open .custom-select-trigger > svg {
  transform: rotate(180deg);
}

.custom-select-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.09);
}

.custom-select-option {
  display: block;
  width: 100%;
  padding: 10px 10px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
}

.custom-select-option:hover {
  background: #f3fbf6;
}

.custom-select-option.is-selected {
  color: var(--green);
  background: #edfaf3;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
}

.date-picker-input {
  padding-right: 42px;
  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'%3E%3Crect x='4' y='5' width='16' height='15' rx='2' stroke='%23151a22' stroke-width='2'/%3E%3Cpath d='M8 3v4M16 3v4M4 10h16' stroke='%23151a22' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
  cursor: pointer;
}

.date-picker-input:hover {
  border-color: rgba(35, 191, 131, 0.45);
}

.custom-date-picker {
  position: fixed;
  z-index: 90;
  display: none;
  width: min(318px, calc(100vw - 20px));
}

.custom-date-picker.is-open {
  display: block;
}

.custom-calendar-panel {
  overflow: hidden;
  border: 1px solid rgba(202, 218, 210, 0.92);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 46px rgba(18, 28, 24, 0.16);
  backdrop-filter: blur(12px);
}

.custom-calendar-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 6px;
  padding: 12px 12px 8px;
}

.custom-calendar-head strong {
  min-width: 0;
  color: #1f2730;
  font-size: 0.98rem;
  font-weight: 900;
  text-align: center;
}

.custom-calendar-head button,
.custom-calendar-foot button,
.custom-calendar-cell {
  border: 0;
  background: transparent;
  color: var(--ink);
}

.custom-calendar-head button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #56616a;
  font-size: 1.15rem;
}

.custom-calendar-head button:hover,
.custom-calendar-foot button:hover,
.custom-calendar-cell:hover {
  background: #f0faf5;
  color: var(--green-dark);
}

.custom-calendar-weekdays,
.custom-calendar-day-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 0 12px;
}

.custom-calendar-weekdays {
  margin: 2px 0 6px;
}

.custom-calendar-weekdays span {
  color: #7b858d;
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
}

.custom-calendar-day-grid {
  padding-bottom: 10px;
}

.custom-calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 4px 14px 12px;
}

.custom-calendar-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  border-radius: 10px;
  font-weight: 760;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.custom-calendar-day {
  aspect-ratio: 1;
  font-size: 0.9rem;
}

.custom-calendar-month {
  min-height: 42px;
  font-size: 0.92rem;
}

.custom-calendar-cell.is-outside {
  color: #aab2b8;
  font-weight: 650;
}

.custom-calendar-cell.is-today {
  box-shadow: inset 0 0 0 1px rgba(35, 191, 131, 0.38);
  color: var(--green-dark);
}

.custom-calendar-cell.is-selected {
  background: var(--green);
  color: #fff;
  box-shadow: 0 8px 18px rgba(35, 191, 131, 0.28);
}

.custom-calendar-cell.is-selected:hover {
  background: var(--green-dark);
  color: #fff;
}

.custom-calendar-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid rgba(230, 235, 232, 0.9);
  padding: 10px 12px 12px;
}

.custom-calendar-foot button {
  min-height: 36px;
  border-radius: 10px;
  padding: 0 12px;
  color: var(--green-dark);
  font-size: 0.86rem;
  font-weight: 850;
}

select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%2359656d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.months-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.months-input input {
  min-height: 40px;
  border: 0;
  border-radius: 0;
}

.months-input b {
  padding: 0 12px 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.budget-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
  align-items: center;
}

.secondary-button,
.primary-button,
.icon-button,
.segmented button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.secondary-button {
  padding: 0 12px;
}

.primary-button,
.segmented button.is-active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.bottom-nav {
  position: fixed;
  right: 50%;
  bottom: 12px;
  z-index: 10;
  width: min(100% - 22px, 448px);
  height: 72px;
  display: grid;
  grid-template-columns: 1fr 1fr 76px 1fr 1fr;
  align-items: center;
  transform: translateX(50%);
  border: 1px solid rgba(230, 235, 232, 0.85);
  border-radius: 24px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 34px rgba(18, 28, 24, 0.12);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 52px;
  border: 0;
  background: transparent;
  color: #59626b;
  font-size: 0.72rem;
}

.nav-item.is-active {
  color: var(--green-dark);
  font-weight: 800;
}

.nav-icon {
  display: block;
  width: 23px;
  height: 23px;
  background: currentColor;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.nav-icon-home {
  -webkit-mask-image: url("assets/nav-home.svg");
  mask-image: url("assets/nav-home.svg");
}

.nav-icon-ledger {
  -webkit-mask-image: url("assets/nav-ledger.svg");
  mask-image: url("assets/nav-ledger.svg");
}

.nav-icon-assets {
  -webkit-mask-image: url("assets/nav-assets.svg");
  mask-image: url("assets/nav-assets.svg");
}

.nav-icon-me {
  -webkit-mask-image: url("assets/nav-me.svg");
  mask-image: url("assets/nav-me.svg");
}

.quick-add {
  position: relative;
  justify-self: center;
  width: 62px;
  height: 62px;
  margin-top: -30px;
  border: 6px solid #fff;
  border-radius: 50%;
  background: linear-gradient(160deg, #49d998, #22b876);
  color: #fff;
  font-size: 0;
  box-shadow: 0 14px 28px rgba(35, 191, 131, 0.35);
}

.quick-add::before,
.quick-add::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  background: #fff;
  transform: translate(-50%, -50%);
}

.quick-add::before {
  width: 26px;
  height: 3px;
}

.quick-add::after {
  width: 3px;
  height: 26px;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
}

.ratio-dialog {
  position: fixed;
  inset: 0;
  z-index: 34;
  display: none;
}

.transaction-dialog {
  position: fixed;
  inset: 0;
  z-index: 36;
  display: none;
}

.ledger-filter-sheet {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: none;
}

.sheet.is-open {
  display: block;
}

.ratio-dialog.is-open {
  display: grid;
  place-items: center;
  padding: 18px;
}

.transaction-dialog.is-open {
  display: grid;
  place-items: center;
  padding: 18px;
}

.ledger-filter-sheet.is-open {
  display: block;
}

.sheet-backdrop,
.ledger-filter-backdrop,
.ratio-dialog-backdrop,
.transaction-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 24, 22, 0.36);
}

.entry-panel {
  position: absolute;
  right: 50%;
  bottom: 0;
  width: min(100%, 470px);
  display: grid;
  gap: 12px;
  transform: translateX(50%);
  border-radius: 24px 24px 0 0;
  padding: 18px 16px 24px;
  background: #fff;
  box-shadow: 0 -16px 42px rgba(0, 0, 0, 0.16);
}

.ratio-dialog-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 390px);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 16px;
  background: #fff;
  box-shadow: var(--deep-shadow);
}

.transaction-dialog-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 410px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 16px;
  background: #fff;
  box-shadow: var(--deep-shadow);
}

.ledger-filter-panel {
  position: absolute;
  right: 50%;
  bottom: 0;
  z-index: 1;
  width: min(100%, 470px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  display: grid;
  gap: 16px;
  transform: translateX(50%);
  border-radius: 22px 22px 0 0;
  padding: 18px 16px 20px;
  background: #fff;
  box-shadow: 0 -16px 42px rgba(0, 0, 0, 0.16);
}

.ledger-filter-search,
.ledger-filter-section {
  display: grid;
  gap: 9px;
}

.ledger-filter-search > span,
.ledger-filter-section > span {
  color: #59656d;
  font-size: 0.8rem;
  font-weight: 850;
}

.ledger-filter-search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: #f9fbfa;
  color: var(--ink);
}

.ledger-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ledger-filter-options button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: #fff;
  color: #4e5963;
  font-size: 0.8rem;
  font-weight: 800;
}

.ledger-filter-options button.is-active {
  border-color: rgba(23, 111, 74, 0.72);
  background: #eef8f1;
  color: #176f4a;
  box-shadow: inset 0 0 0 1px rgba(23, 111, 74, 0.18);
}

.ledger-filter-subsection {
  display: grid;
  gap: 6px;
  margin-top: -1px;
}

.ledger-filter-subsection[hidden] {
  display: none;
}

.ledger-filter-subsection > span {
  color: #59656d;
  font-size: 0.8rem;
  font-weight: 850;
}

.ledger-custom-amount {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.ledger-custom-amount input {
  min-height: 40px;
  font-size: 0.82rem;
}

.ledger-custom-amount span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.ledger-filter-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: 10px;
  padding-top: 2px;
}

.transaction-detail-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fbf8f0;
}

.transaction-detail-card > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--detail-soft, #edf4e8);
  color: var(--detail-color, var(--green-dark));
  font-weight: 950;
}

.transaction-detail-card > span:has(img) {
  background: transparent;
}

.transaction-detail-card > span img {
  display: block;
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.transaction-detail-card div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.transaction-detail-card strong,
.transaction-detail-card em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transaction-detail-card strong {
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 950;
}

.transaction-detail-card em {
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 750;
}

.transaction-detail-card b {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
  white-space: nowrap;
}

.custom-ratio-editor {
  display: grid;
  gap: 10px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  font-size: 1.2rem;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 7px;
  padding: 5px;
  border-radius: 13px;
  background: var(--soft);
}

.segmented[hidden] {
  display: none;
}

.new-holding-inline {
  border: 1px solid color-mix(in srgb, var(--green) 24%, var(--line));
  border-radius: 12px;
  padding: 12px;
  background: color-mix(in srgb, var(--green) 7%, #fff);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.new-holding-inline > strong {
  color: #1e2b34;
  font-size: 0.88rem;
}

.new-holding-inline[hidden] {
  display: none;
}

.investment-type-field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
}

.choice-row button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #4e5963;
  font-size: 0.82rem;
  font-weight: 750;
}

.choice-row button.is-active {
  border-color: rgba(23, 111, 74, 0.72);
  background: #f3fbf6;
  color: #176f4a;
  box-shadow: inset 0 0 0 1px rgba(23, 111, 74, 0.28);
}

.sheet-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.account-metrics .metric-link {
  min-width: 0;
  min-height: 0;
  border: 0;
  border-left: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.18;
  text-align: left;
  display: block;
}

.account-metrics .metric-link:first-child {
  border-left: 0;
  padding-left: 0;
}

.account-metrics .metric-link b {
  display: block;
  margin-top: 0;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 900;
  white-space: nowrap;
}

.account-metrics .metric-link small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 720;
  white-space: nowrap;
}

.account-metrics .metric-link:hover,
.account-metrics .metric-link:focus-visible {
  color: var(--accent);
  outline: none;
}

.account-metrics .metric-link:hover b,
.account-metrics .metric-link:focus-visible b {
  color: var(--accent);
}

.account-view-dashboard {
  display: grid;
  gap: 14px;
  margin-top: 4px;
  padding-bottom: 104px;
}

.account-view-hero,
.account-view-status,
.account-view-chart {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.account-view-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 18px;
  align-items: center;
  width: 100%;
  min-height: 92px;
  padding: 18px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.account-view-hero:not(.is-static):hover,
.account-view-hero:not(.is-static):focus-visible {
  border-color: color-mix(in srgb, var(--accent), #ffffff 22%);
  background: linear-gradient(135deg, var(--soft), #ffffff 68%);
  outline: none;
}

.account-view-hero span,
.account-view-status span,
.account-view-chart-head span {
  color: #3c4a54;
  font-size: 0.86rem;
  font-weight: 800;
}

.account-view-hero strong {
  grid-row: span 2;
  color: var(--accent);
  font-size: 1.75rem;
  font-weight: 950;
  white-space: nowrap;
}

.account-view-hero em,
.account-view-status em {
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 700;
}

.account-view-hero:not(.is-static) em::after {
  content: " >";
}

.account-view-hero.is-static {
  cursor: default;
}

.account-view-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: center;
  padding: 16px 18px;
  background: #fffaf2;
}

.account-view-status strong {
  grid-row: span 2;
  color: var(--orange);
  font-size: 1.35rem;
  font-weight: 950;
  white-space: nowrap;
}

.account-view-status.is-over {
  background: #fff5f2;
}

.account-view-status.is-over span,
.account-view-status.is-over strong {
  color: #d94738;
}

.account-view-status.is-balanced {
  background: var(--soft);
}

.account-view-status.is-balanced span,
.account-view-status.is-balanced strong {
  color: var(--green-dark);
}

.account-view-chart {
  padding: 16px;
}

.account-view-chart-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.account-view-chart-head b {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.account-view-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.account-view-bar-row:first-of-type {
  border-top: 0;
}

.account-view-bar-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.account-view-bar-copy strong {
  overflow: hidden;
  color: #2f3e47;
  font-size: 0.86rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-view-bar-copy span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.account-view-bar-track {
  grid-column: 1 / -1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f0;
}

.account-view-bar-track span {
  display: block;
  width: var(--bar);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent), #ffffff 36%));
}

.account-view-bar-row > b {
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 950;
  white-space: nowrap;
}

.view-list {
  display: grid;
  gap: 0;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
}

.view-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 54px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

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

.view-row-label {
  color: #3c4a54;
  font-size: 0.9rem;
  font-weight: 750;
}

.view-row-value {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  white-space: nowrap;
}

.view-row-total {
  background: var(--soft);
}

.view-row-total .view-row-value {
  color: var(--green-dark);
}

.view-row-budget {
  background: #f5f7fa;
}

.view-row-budget .view-row-label,
.view-row-budget .view-row-value {
  color: var(--muted);
  font-size: 0.86rem;
}

.view-row-over .view-row-label,
.view-row-over .view-row-value {
  color: #d94738;
}

.view-row-gap .view-row-label {
  color: var(--muted);
}

.view-row-gap .view-row-value {
  color: var(--orange);
}

@media (min-width: 700px) {
  body {
    background:
      radial-gradient(circle at top, rgba(35, 191, 131, 0.1), transparent 36%),
      var(--bg);
  }

  .app-shell {
    box-shadow: 0 0 0 1px rgba(230, 235, 232, 0.7), 0 22px 70px rgba(18, 28, 24, 0.1);
  }
}

@media (max-width: 390px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .ledger-header {
    align-items: flex-start;
    gap: 10px;
  }

  .ledger-header h1 {
    font-size: 1.72rem;
  }

  .ledger-month-control .month-pill {
    min-width: 126px;
    padding: 0 10px;
  }

  .ledger-summary-card {
    margin-top: 24px;
    padding-right: 4px;
    padding-left: 4px;
  }

  .ledger-summary-card div {
    padding: 0 4px;
  }

  .ledger-summary-card span {
    font-size: 0.72rem;
  }

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

  .ledger-tabs {
    gap: 8px;
  }

  .ledger-tabs button {
    min-height: 35px;
    padding: 0 13px;
    font-size: 0.78rem;
  }

  .ledger-filter-button {
    min-height: 35px;
    font-size: 0.78rem;
  }

  .ledger-day-head {
    display: grid;
    gap: 5px;
  }

  .ledger-day-head span {
    text-align: left;
    white-space: normal;
  }

  .ledger-transaction-row {
    grid-template-columns: 38px minmax(0, 1fr) minmax(64px, auto);
    gap: 9px;
    min-height: 68px;
    padding: 12px 10px;
  }

  .ledger-entry-icon {
    width: 34px;
    height: 34px;
    font-size: 0.92rem;
  }

  .ledger-entry-main strong {
    font-size: 0.82rem;
  }

  .ledger-entry-main span {
    font-size: 0.68rem;
  }

  .ledger-amount {
    font-size: 0.94rem;
  }

  .transaction-dialog {
    align-items: end;
    padding: 0;
  }

  .transaction-dialog-panel {
    width: 100%;
    max-height: calc(100vh - 42px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
  }

  .transaction-detail-card {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  .transaction-detail-card b {
    font-size: 0.9rem;
  }

  .hero-copy > strong {
    font-size: 2.56rem;
  }

  .hero-art {
    right: -54px;
    width: 64%;
  }

  .monthly-result-section {
    margin-top: 14px;
  }

  .overview-grid {
    gap: 8px;
  }

  .overview-card {
    min-height: 144px;
    padding: 16px 12px 14px;
  }

  .overview-card h3 {
    font-size: 0.74rem;
  }

  .overview-card > strong {
    margin-top: 12px;
    font-size: 1.58rem;
  }

  .overview-divider {
    margin: 15px 0 12px;
  }

  .overview-breakdown {
    gap: 8px;
  }

  .overview-breakdown em {
    font-size: 0.64rem;
  }

  .overview-breakdown b {
    font-size: 0.68rem;
  }

  .style-section {
    padding-right: 14px;
    padding-left: 14px;
  }

  .style-section .section-head {
    padding: 0;
  }

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

  .style-chart-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    min-height: 166px;
    padding: 0;
  }

  .style-chart-stack {
    min-height: 154px;
  }

  .chart-wrap {
    width: min(100%, 148px);
  }

  .chart-center {
    inset: 34px;
  }

  .chart-center span {
    font-size: 0.62rem;
  }

  .chart-center strong {
    margin-top: 3px;
    font-size: 0.78rem;
  }

  .legend-row {
    grid-template-columns: 8px minmax(0, 1fr) 60px;
    gap: 5px;
    min-height: 38px;
    padding: 5px 0;
  }

  .legend-row strong {
    font-size: 0.7rem;
  }

  .legend-budget-field {
    width: 60px;
  }

  .legend-budget-field input {
    width: 48px;
  }

  .legend-budget-field span,
  .legend-budget-field input {
    font-size: 0.68rem;
  }

  .legend-row em {
    margin-top: 2px;
    font-size: 0.58rem;
  }

  .dot {
    width: 8px;
    height: 8px;
  }

  .style-option {
    grid-template-columns: 21px minmax(0, 1fr) 18px;
    gap: 6px;
    min-height: 48px;
    padding: 0 8px;
  }

  .budget-style-picker {
    gap: 7px;
  }

  .budget-style-picker .style-option {
    min-height: 54px;
    padding: 8px;
  }

  .style-icon {
    font-size: 1.08rem;
  }

  .style-option strong {
    font-size: 0.78rem;
  }

  .style-option em {
    font-size: 0.6rem;
  }

  .style-radio {
    width: 18px;
    height: 18px;
  }

  .result-equation {
    grid-template-columns: minmax(0, 1fr) 17px minmax(0, 1fr) 17px minmax(0, 1fr);
    gap: 4px;
  }

  .result-card {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 5px;
    min-height: 86px;
    padding: 8px 5px;
    text-align: center;
  }

  .result-icon {
    width: 32px;
    height: 32px;
  }

  .result-label {
    justify-content: center;
    font-size: 0.66rem;
  }

  .result-card strong {
    font-size: 0.88rem;
  }

  .account-row {
    grid-template-columns: 44px minmax(0, 1fr) 82px 52px;
    gap: 8px;
    padding: 11px 9px;
  }

  .account-icon {
    width: 38px;
    height: 38px;
  }

  .account-main h3 {
    font-size: 0.92rem;
  }

  .account-main p {
    font-size: 0.68rem;
  }

  .account-metrics {
    gap: 5px;
  }

  .account-metrics span,
  .account-metrics .metric-link {
    padding-left: 0;
    font-size: 0.62rem;
  }

  .account-metrics b,
  .account-metrics .metric-link b {
    font-size: 0.72rem;
  }

  .account-progress {
    width: 46px;
    height: 46px;
  }

  .account-progress span {
    width: 36px;
    height: 36px;
    font-size: 0.76rem;
  }

  .asset-account-row {
    grid-template-columns: 44px minmax(0, 1fr) 82px 52px;
  }

  .choice-row {
    gap: 6px;
  }

  .choice-row button {
    font-size: 0.74rem;
  }

  .account-detail {
    padding: 12px;
  }

  .account-detail-metrics {
    gap: 6px;
  }

  .account-detail-metrics span,
  .account-detail-metrics .metric-link {
    padding: 7px 6px;
    font-size: 0.62rem;
  }

  .account-detail-metrics b,
  .account-detail-metrics .metric-link b {
    font-size: 0.72rem;
  }

  .account-tests span,
  .category-tags span {
    font-size: 0.66rem;
  }

  .breakdown-item,
  .breakdown-add-form {
    grid-template-columns: minmax(0, 1fr) 86px 34px;
    gap: 6px;
  }

  .breakdown-add-form {
    grid-template-columns: minmax(0, 1fr) 76px 52px;
  }

}

@media (max-width: 340px) {
  .ledger-transaction-row {
    grid-template-columns: 34px minmax(0, 1fr) minmax(62px, auto);
    gap: 8px;
  }
}

/* ─── Assets Page ────────────────────────────────────────── */

.assets-page-header h1 {
  font-size: 1.78rem;
}

/* Overview card */
.asset-title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.asset-title-row h2 {
  margin: 0;
}

.asset-privacy-toggle {
  width: 32px;
  min-width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #66727a;
}

.asset-privacy-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.asset-privacy-toggle[aria-pressed="true"] {
  color: var(--green-dark);
  background: color-mix(in srgb, var(--green) 7%, #fff);
  border-color: color-mix(in srgb, var(--green) 30%, var(--line));
}

.asset-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
  margin-top: 14px;
}

.asset-metric > span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.asset-metric > strong {
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.asset-metric strong.is-positive { color: var(--green-dark); }
.asset-metric strong.is-negative { color: #4d5964; }

/* Safety period */
.asset-safety-card {
  border-color: color-mix(in srgb, var(--green) 18%, var(--line));
  padding: 12px 14px;
}

.asset-safety-card .section-head {
  align-items: flex-start;
  margin-bottom: 8px;
}

.asset-safety-card .section-head h2 {
  margin: 0;
  font-size: 1.04rem;
}

.asset-safety-card .section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.safety-month-control {
  flex: 0 0 auto;
  display: inline-grid;
  grid-template-columns: 24px auto 1px 42px auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid color-mix(in srgb, var(--green) 22%, var(--line));
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--green-dark);
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(26, 76, 58, 0.12);
}

.safety-month-control span,
.safety-month-control b {
  margin: 0;
  color: inherit;
  font-size: 0.78rem;
  white-space: nowrap;
}

.safety-month-control .safety-target-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--green);
  font-size: 1.25rem;
  line-height: 1;
}

.safety-month-control i {
  width: 1px;
  height: 18px;
  background: color-mix(in srgb, var(--green) 18%, var(--line));
}

.safety-month-control input {
  width: 42px;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 2px 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
  text-align: center;
}

.safety-month-control input::-webkit-outer-spin-button,
.safety-month-control input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.safety-month-control input[type="number"] {
  appearance: textfield;
}

.safety-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  margin-top: 12px;
}

.safety-hero em,
.safety-grid em {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
}

.safety-hero strong {
  display: block;
  color: var(--ink);
  font-size: 1.48rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.safety-hero em {
  align-self: center;
  text-align: right;
  white-space: nowrap;
}

.asset-safety-card.is-safe .safety-hero strong {
  color: var(--green-dark);
}

.asset-safety-card.is-gap .safety-hero strong {
  color: var(--pink);
}

.safety-bar {
  height: 7px;
  margin: 10px 0 8px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 10%, #f1eee5);
}

.safety-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.safety-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--green) 14%, var(--line));
}

.safety-grid > span {
  min-width: 0;
  padding: 0;
}

.safety-grid b {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 0.88rem;
}

/* Holdings section */
.holdings-section { padding: 14px 14px 8px; }

.holdings-section .section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

.holding-group {
  padding-top: 10px;
}

.holding-group + .holding-group {
  margin-top: 6px;
  border-top: 1px solid var(--line);
}

.holding-group-head {
  display: grid;
  gap: 2px;
  padding: 6px 0 2px;
}

.holding-group-head strong {
  font-size: 0.9rem;
  color: var(--ink);
}

.holding-group-head span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.holdings-header {
  display: grid;
  grid-template-columns: 1fr 80px 72px 56px;
  gap: 4px;
  padding: 6px 0 8px;
  font-size: 0.72rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.holding-row {
  display: grid;
  grid-template-columns: 1fr 80px 72px 56px;
  gap: 4px;
  align-items: center;
  width: 100%;
  padding: 10px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.84rem;
}

.holding-row:last-of-type { border-bottom: none; }

.holdings-header span:not(:first-child),
.holding-value,
.holding-profit,
.holding-rate { text-align: right; }

.holding-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.holding-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--hc) 15%, transparent);
  color: var(--hc);
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.holding-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.holding-name b {
  font-size: 0.84rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holding-name em {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--muted);
}

.holding-term { color: var(--accent, #8c67b7) !important; }

.holding-value {
  font-size: 0.84rem;
  font-weight: 600;
  text-align: right;
}

.holding-profit,
.holding-rate {
  font-size: 0.78rem;
  font-weight: 600;
  text-align: right;
}

.holding-profit.is-positive,
.holding-rate.is-positive { color: var(--green-dark); }
.holding-profit.is-negative,
.holding-rate.is-negative { color: #4d5964; }

.holdings-more-btn {
  display: block;
  width: 100%;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  cursor: pointer;
}

.asset-action-menu {
  position: relative;
  flex: 0 0 auto;
}

.asset-add-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--green) 34%, var(--line));
  border-radius: 8px;
  padding: 0 10px;
  background: color-mix(in srgb, var(--green) 8%, #fff);
  color: var(--green-dark);
  font-size: 0.8rem;
  font-weight: 800;
}

.asset-add-button span {
  font-size: 1.05rem;
  line-height: 1;
}

.asset-add-button em {
  font-style: normal;
}

.asset-action-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  width: min(210px, calc(100vw - 44px));
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(30, 43, 52, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.asset-action-menu:focus-within .asset-action-popover,
.asset-action-menu:hover .asset-action-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.asset-action-popover button {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 0;
  border-radius: 7px;
  padding: 9px 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.asset-action-popover button:hover,
.asset-action-popover button:focus-visible {
  background: color-mix(in srgb, var(--green) 8%, #f7f4ed);
  outline: none;
}

.asset-action-popover strong {
  font-size: 0.84rem;
  font-weight: 850;
}

.asset-action-popover span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.holdings-empty {
  padding: 16px 0 8px;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

/* Trend chart */
.asset-chart-card { overflow: hidden; }

.asset-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.asset-chart-head h2 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 1rem;
}

.asset-chart-head span {
  color: var(--muted);
  font-size: 0.76rem;
}

.asset-chart-head b {
  font-weight: 850;
}

.asset-chart-head b.is-positive {
  color: var(--green-dark);
}

.asset-chart-head b.is-negative {
  color: #4d5964;
}

.asset-trend-control {
  flex: 0 0 auto;
  display: inline-grid;
  grid-template-columns: auto 42px auto;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--green) 22%, var(--line));
  border-radius: 999px;
  padding: 4px 9px;
  background: color-mix(in srgb, var(--green) 5%, #fff);
  color: var(--green-dark);
  font-weight: 800;
}

.asset-trend-control span,
.asset-trend-control b {
  margin: 0;
  color: inherit;
  font-size: 0.72rem;
  white-space: nowrap;
}

.asset-trend-control input {
  width: 42px;
  min-height: 26px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 850;
  text-align: center;
}

.chart-legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.76rem;
  color: var(--muted);
}

.chart-legend-dot {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--green);
}

/* Footer note */
.asset-page-note {
  margin-top: 12px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--green) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--green) 20%, transparent);
  border-radius: 12px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.6;
}

/* Holding delete button */
.holding-delete-button {
  color: var(--pink);
  border-color: color-mix(in srgb, var(--pink) 30%, transparent);
  background: color-mix(in srgb, var(--pink) 6%, transparent);
  width: 100%;
}

