:root {
  --ink: #17231f;
  --ink-soft: #52605b;
  --paper: #f4f0e7;
  --paper-deep: #ebe5d9;
  --white: #fffdf8;
  --line: rgba(23, 35, 31, 0.13);
  --line-strong: rgba(23, 35, 31, 0.24);
  --personal: #21755f;
  --personal-soft: #d9eee7;
  --pension: #c85e4a;
  --pension-soft: #f5ded7;
  --freedom: #3d62aa;
  --freedom-soft: #dfe7f6;
  --positive: #21755f;
  --negative: #c45a48;
  --shadow: 0 18px 50px rgba(42, 48, 43, 0.09);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(23, 35, 31, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 35, 31, 0.024) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button,
a,
select,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(61, 98, 170, 0.28);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 440px;
  height: 440px;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.5;
  pointer-events: none;
}

.ambient-one {
  top: -210px;
  right: -130px;
  background: radial-gradient(circle at center, rgba(33, 117, 95, 0.18), transparent 68%);
}

.ambient-two {
  bottom: 4%;
  left: -250px;
  background: radial-gradient(circle at center, rgba(200, 94, 74, 0.13), transparent 68%);
}

.topbar {
  position: relative;
  z-index: 10;
  width: min(1440px, calc(100% - 64px));
  height: calc(96px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 10px;
  border-radius: 15px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 8px 20px rgba(23, 35, 31, 0.2);
}

.brand-mark span {
  width: 6px;
  border-radius: 6px;
  background: #f6d46b;
}

.brand-mark span:nth-child(1) { height: 11px; }
.brand-mark span:nth-child(2) { height: 18px; background: #8dd0ba; }
.brand-mark span:nth-child(3) { height: 14px; background: #e98c78; }

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 20px;
  letter-spacing: 0.12em;
}

.brand small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.08em;
}

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

.secret-trigger {
  width: 30px;
  height: 30px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: rgba(23, 35, 31, 0.34);
  background: transparent;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.secret-trigger:hover {
  color: var(--ink);
  background: rgba(23, 35, 31, 0.07);
  transform: translateY(-1px);
}

.secret-trigger svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button,
.close-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 253, 248, 0.68);
  backdrop-filter: blur(12px);
}

.icon-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12px;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.icon-button:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: var(--white);
}

.icon-button svg,
.primary-button svg,
.close-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  width: min(1440px, calc(100% - 64px));
  margin: 0 auto;
}

.overview {
  min-height: 410px;
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(330px, 0.9fr);
  overflow: hidden;
  border-radius: 34px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 30px 70px rgba(23, 35, 31, 0.2);
  animation: rise-in 600ms ease both;
}

.overview-main {
  position: relative;
  min-width: 0;
  padding: 52px 60px 44px;
  background:
    radial-gradient(circle at 83% 12%, rgba(246, 212, 107, 0.15), transparent 30%),
    linear-gradient(125deg, rgba(255, 255, 255, 0.04), transparent 35%);
}

.overview-main::after {
  content: "";
  position: absolute;
  right: 5%;
  bottom: -80px;
  width: 250px;
  height: 250px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(255, 255, 255, 0.025), 0 0 0 76px rgba(255, 255, 255, 0.018);
  pointer-events: none;
}

.eyebrow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow,
.save-status {
  position: relative;
  z-index: 1;
  font-size: 12px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.08em;
}

.eyebrow i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8dd0ba;
  box-shadow: 0 0 0 5px rgba(141, 208, 186, 0.11);
}

.save-status {
  color: rgba(255, 255, 255, 0.48);
}

.overview-label {
  position: relative;
  z-index: 1;
  margin: 52px 0 8px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 16px;
}

.grand-total {
  position: relative;
  z-index: 1;
  overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(50px, 5.3vw, 86px);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.overview-note {
  position: relative;
  z-index: 1;
  margin: 14px 0 30px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 13px;
}

.account-legend {
  position: relative;
  z-index: 1;
  max-width: 680px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.legend-item {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.legend-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
}

.legend-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--account-color);
}

.legend-value {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.month-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 48px 44px 42px;
  color: var(--ink);
  background: #f3d872;
}

.month-panel::before {
  content: "";
  position: absolute;
  right: -48px;
  bottom: -50px;
  width: 180px;
  height: 180px;
  border: 28px solid rgba(23, 35, 31, 0.055);
  border-radius: 50%;
}

.month-heading,
.month-split {
  position: relative;
  z-index: 1;
}

.month-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.panel-kicker {
  display: block;
  margin-bottom: 5px;
  color: rgba(23, 35, 31, 0.56);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.month-heading strong {
  font-size: 22px;
}

.month-picker-wrap input {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(23, 35, 31, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.36);
  color: transparent;
}

.month-picker-wrap input::-webkit-calendar-picker-indicator {
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0.65;
  cursor: pointer;
}

.month-net {
  position: relative;
  z-index: 1;
  margin: auto 0 30px;
}

.month-net span {
  display: block;
  margin-bottom: 8px;
  color: rgba(23, 35, 31, 0.56);
  font-size: 13px;
}

.month-net strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 3.2vw, 50px);
  font-weight: 400;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.month-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.month-split > div {
  position: relative;
  padding: 16px;
  border: 1px solid rgba(23, 35, 31, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.32);
}

.month-split p {
  margin: 2px 0 5px;
  color: rgba(23, 35, 31, 0.56);
  font-size: 11px;
}

.month-split strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.stat-dot {
  position: absolute;
  top: 18px;
  right: 16px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.stat-dot.income { background: var(--positive); }
.stat-dot.expense { background: var(--negative); }

.accounts-section,
.flow-section {
  padding-top: 76px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-heading > div:first-child {
  display: flex;
  align-items: center;
  gap: 16px;
}

.section-index {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
}

.section-heading h1,
.section-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.primary-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(23, 35, 31, 0.16);
  font-size: 13px;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(23, 35, 31, 0.22);
}

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

.account-card {
  --account-color: var(--personal);
  --account-soft: var(--personal-soft);
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.86);
  box-shadow: var(--shadow);
  animation: rise-in 520ms ease both;
}

.account-card:nth-child(2) { animation-delay: 70ms; }
.account-card:nth-child(3) { animation-delay: 140ms; }

.account-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 42%;
  height: 8px;
  border-radius: 0 0 0 8px;
  background: var(--account-color);
}

.account-card-head {
  padding: 25px 25px 20px;
  border-bottom: 1px solid var(--line);
}

.account-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.account-name-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-glyph {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  color: var(--account-color);
  background: var(--account-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 700;
}

.account-name {
  margin: 0;
  font-size: 17px;
}

.account-purpose {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.account-share {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--account-color);
  background: var(--account-soft);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.account-total-label {
  margin: 24px 0 5px;
  color: var(--ink-soft);
  font-size: 11px;
}

.account-total {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(31px, 2.7vw, 42px);
  font-weight: 400;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.distribution-track {
  height: 6px;
  margin-top: 20px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--account-soft);
}

.distribution-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--account-color);
  transition: width 420ms ease;
}

.branch-list {
  padding: 8px 15px 6px;
}

.branch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 13px 10px;
  border-bottom: 1px dashed var(--line);
}

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

.branch-info {
  min-width: 0;
}

.branch-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
}

.branch-name::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--account-color);
}

.branch-balance {
  margin: 0 0 0 13px;
  color: var(--ink-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.branch-actions {
  display: flex;
  gap: 5px;
}

.mini-action {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 17px;
  line-height: 1;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.mini-action.add:hover {
  border-color: rgba(33, 117, 95, 0.25);
  color: var(--positive);
  background: var(--personal-soft);
}

.mini-action.subtract:hover {
  border-color: rgba(200, 94, 74, 0.25);
  color: var(--negative);
  background: var(--pension-soft);
}

.account-card-foot {
  padding: 12px 25px 20px;
}

.add-branch-button {
  width: 100%;
  min-height: 38px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 11px;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.add-branch-button:hover {
  border-color: var(--account-color);
  color: var(--account-color);
  background: var(--account-soft);
}

.flow-section {
  padding-bottom: 80px;
}

.filter-select select {
  min-width: 150px;
  height: 42px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.8);
}

.transaction-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.78);
  box-shadow: var(--shadow);
}

.transaction-list {
  padding: 10px 24px;
}

.transaction-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 17px 4px;
  border-bottom: 1px solid var(--line);
}

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

.transaction-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
}

.transaction-icon.income {
  color: var(--positive);
  background: var(--personal-soft);
}

.transaction-icon.expense {
  color: var(--negative);
  background: var(--pension-soft);
}

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

.transaction-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
}

.account-pill {
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--account-color);
  background: var(--account-soft);
  font-size: 9px;
  font-weight: 700;
}

.transaction-meta {
  margin: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transaction-amount {
  min-width: 118px;
  text-align: right;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.transaction-amount.income { color: var(--positive); }
.transaction-amount.expense { color: var(--negative); }

.undo-button {
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 10px;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.undo-button:hover {
  color: var(--negative);
  text-decoration-color: currentColor;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 40px;
  text-align: center;
}

.empty-state > div {
  max-width: 360px;
}

.empty-mark {
  width: 54px;
  height: 54px;
  display: grid;
  margin: 0 auto 14px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-soft);
  background: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
}

.empty-state h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.empty-state p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.footer {
  width: min(1440px, calc(100% - 64px));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 auto;
  padding: 22px 0 calc(40px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 10px;
}

.footer-divider {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

.modal {
  width: min(570px, calc(100% - 32px));
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 26px;
  background: transparent;
  color: var(--ink);
}

.compact-modal {
  width: min(480px, calc(100% - 32px));
}

.secret-modal {
  width: min(540px, calc(100% - 28px));
}

.modal-card.secret-card {
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  border-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  background:
    radial-gradient(circle at 90% 4%, rgba(246, 212, 107, 0.13), transparent 30%),
    #17231f;
}

.secret-card::after {
  content: "";
  position: absolute;
  right: -75px;
  bottom: -90px;
  width: 210px;
  height: 210px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(255, 255, 255, 0.018), 0 0 0 68px rgba(255, 255, 255, 0.012);
  pointer-events: none;
}

.secret-header {
  position: relative;
  z-index: 1;
}

.secret-header .modal-kicker {
  color: rgba(255, 255, 255, 0.44);
  letter-spacing: 0.18em;
}

.secret-header .close-button {
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.05);
}

.secret-total-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 10px;
  margin-bottom: 26px;
}

.secret-total-grid > div {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
}

.secret-total-primary {
  color: #17231f;
  background: #f3d872;
}

.secret-total-combined {
  background: rgba(255, 255, 255, 0.055);
}

.secret-total-grid span {
  display: block;
  margin-bottom: 8px;
  color: inherit;
  font-size: 10px;
  opacity: 0.58;
}

.secret-total-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 5vw, 34px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.secret-total-combined strong {
  color: #f6d46b;
  font-size: clamp(20px, 4vw, 28px);
}

.secret-section-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
}

.secret-section-head i {
  color: rgba(255, 255, 255, 0.34);
  font-size: 9px;
  font-style: normal;
}

.secret-branch-list {
  position: relative;
  z-index: 1;
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.035);
}

.secret-branch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

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

.secret-branch-name {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
}

.secret-branch-balance {
  margin: 0;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.secret-branch-actions {
  display: flex;
  gap: 6px;
}

.secret-branch-actions .mini-action {
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.035);
}

.secret-add-button {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 42px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 13px;
  color: rgba(255, 255, 255, 0.52);
  background: transparent;
  font-size: 10px;
}

.secret-add-button:hover {
  border-color: rgba(246, 212, 107, 0.46);
  color: #f6d46b;
  background: rgba(246, 212, 107, 0.05);
}

.secret-privacy-note {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 20px 0 0;
  color: rgba(255, 255, 255, 0.32);
  font-size: 9px;
}

.secret-privacy-note svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.modal::backdrop {
  background: rgba(15, 24, 21, 0.62);
  backdrop-filter: blur(8px);
}

.modal[open] .modal-card {
  animation: modal-in 220ms ease both;
}

.modal-card {
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px);
  padding: 28px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 26px;
  background: var(--white);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
}

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

.modal-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.modal-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 400;
}

.close-button {
  width: 38px;
  height: 38px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border-radius: 12px;
}

.operation-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
  padding: 5px;
  border-radius: 16px;
  background: var(--paper);
}

.operation-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.operation-switch span {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  transition: all 150ms ease;
}

.operation-switch b {
  font-size: 18px;
  font-weight: 400;
}

.operation-switch input:checked + span {
  border-color: var(--line);
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 6px 16px rgba(23, 35, 31, 0.08);
}

.operation-switch label:first-child input:checked + span b { color: var(--positive); }
.operation-switch label:last-child input:checked + span b { color: var(--negative); }

.form-grid {
  display: grid;
  gap: 14px;
}

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

.field {
  display: block;
  margin-bottom: 16px;
}

.field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.field em {
  font-style: normal;
  font-weight: 400;
  opacity: 0.7;
}

.field input,
.field select {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #faf8f2;
}

.field input::placeholder {
  color: #9aa19e;
}

.amount-field > div {
  position: relative;
}

.amount-field i {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  color: var(--ink-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-style: normal;
}

.amount-field input {
  height: 64px;
  padding-left: 42px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.balance-preview {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  padding: 0 13px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--ink-soft);
  background: var(--paper);
  font-size: 11px;
}

.balance-preview strong {
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.form-help {
  margin: -5px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.text-button {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
}

.modal-submit {
  min-width: 120px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  max-width: min(360px, calc(100% - 48px));
  padding: 13px 17px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 18px 50px rgba(23, 35, 31, 0.3);
  font-size: 12px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms ease, opacity 220ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.ios-install-card {
  position: fixed;
  z-index: 90;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  left: 14px;
  max-width: 520px;
  min-height: 78px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 12px;
  margin: 0 auto;
  padding: 12px 44px 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  color: #fff;
  background: rgba(23, 35, 31, 0.96);
  box-shadow: 0 24px 70px rgba(15, 24, 21, 0.34);
  backdrop-filter: blur(18px);
  transform: translateY(calc(100% + 34px));
  opacity: 0;
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease;
}

.ios-install-card[hidden] {
  display: none;
}

.ios-install-card.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.ios-install-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  padding: 11px 10px;
  border-radius: 14px;
  background: #0d1915;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.ios-install-icon span {
  width: 6px;
  border-radius: 6px;
}

.ios-install-icon span:nth-child(1) { height: 12px; background: #f6d46b; }
.ios-install-icon span:nth-child(2) { height: 22px; background: #8dd0ba; }
.ios-install-icon span:nth-child(3) { height: 16px; background: #e98c78; }

.ios-install-copy {
  min-width: 0;
}

.ios-install-copy strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.ios-install-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  line-height: 1.55;
}

.ios-install-copy b {
  color: #f6d46b;
  font-weight: 700;
}

.ios-share-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #17231f;
  background: #f6d46b;
}

.ios-share-mark svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ios-install-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.52);
  background: transparent;
  font-size: 20px;
}

.is-standalone .ios-install-card {
  display: none !important;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 1100px) {
  .overview {
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  }

  .overview-main {
    padding: 46px 42px 40px;
  }

  .month-panel {
    padding: 44px 30px 38px;
  }

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

  .account-card:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar,
  .app-shell,
  .footer {
    width: min(100% - 28px, 1440px);
  }

  .topbar {
    height: calc(76px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
  }

  .desktop-only {
    display: none;
  }

  .icon-button {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
  }

  .secret-trigger {
    width: 26px;
    height: 36px;
  }

  .mini-action {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .field input,
  .field select,
  .filter-select select {
    font-size: 16px;
  }

  .overview {
    grid-template-columns: 1fr;
    border-radius: 26px;
  }

  .overview-main {
    padding: 34px 25px 28px;
  }

  .overview-label {
    margin-top: 38px;
  }

  .grand-total {
    font-size: clamp(42px, 13vw, 64px);
  }

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

  .legend-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
  }

  .legend-value {
    margin-top: 0;
  }

  .month-panel {
    min-height: 300px;
    padding: 30px 25px;
  }

  .month-net {
    margin: 38px 0 24px;
  }

  .accounts-section,
  .flow-section {
    padding-top: 54px;
  }

  .section-heading {
    align-items: center;
  }

  .section-heading h1,
  .section-heading h2 {
    font-size: 27px;
  }

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

  .account-card:last-child {
    grid-column: auto;
  }

  .flow-heading {
    align-items: flex-end;
  }

  .filter-select select {
    position: absolute;
    inset: 0;
    min-width: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    opacity: 0;
  }

  .filter-select {
    position: relative;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255, 253, 248, 0.8);
  }

  .filter-select::after {
    content: "筛";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 700;
    pointer-events: none;
  }

  .transaction-list {
    padding: 8px 16px;
  }

  .transaction-row {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .transaction-icon {
    width: 36px;
    height: 36px;
  }

  .transaction-amount {
    min-width: 0;
    font-size: 17px;
  }

  .undo-button {
    grid-column: 2 / -1;
    justify-self: end;
  }

  .two-columns {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .modal-card {
    padding: 22px;
  }

  .ios-install-card {
    grid-template-columns: 46px minmax(0, 1fr) 32px;
    min-height: 76px;
    border-radius: 20px;
  }

  .secret-card {
    padding: 23px 20px calc(22px + env(safe-area-inset-bottom, 0px));
  }

  .secret-total-grid {
    grid-template-columns: 1fr;
  }

  .secret-total-grid > div {
    padding: 16px;
  }

  .secret-total-grid strong,
  .secret-total-combined strong {
    font-size: 27px;
  }
}

@media (max-width: 440px) {
  .brand small {
    display: none;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .section-heading > div:first-child {
    gap: 10px;
  }

  .section-index {
    width: 36px;
    height: 36px;
  }

  .primary-button {
    padding: 0 13px;
  }

  .account-card-head {
    padding: 22px 20px 18px;
  }

  .month-split {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
