

:root {
  --blue-950: #073653;
  --blue-900: #0b4d73;
  --blue-800: #13678f;
  --ink: #183348;
  --muted: #8193a2;
  --line: #e7edf2;
  --canvas: #f3f6f9;
  --white: #ffffff;
  --orange: #f17920;
  --green: #2dbd67;
  --red: #e75850;
}

* {
  box-sizing: border-box;
}

html {
  background: #d7e0e7;
  min-width: 320px;
}

body {
  background:
    radial-gradient(circle at 50% 10%, #f8fafc 0%, #e4eaef 46%, #ccd6de 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  margin: 0;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.device-stage {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.iphone-frame {
  background:
    linear-gradient(105deg, #0c1720 0%, #314657 9%, #101d27 18%, #08121a 51%, #273c4c 88%, #0a141c 100%);
  border: 1px solid #4d6474;
  border-radius: 66px;
  box-shadow:
    0 38px 76px rgba(29, 52, 68, 0.34),
    0 10px 20px rgba(24, 43, 56, 0.25),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 0 0 3px rgba(0, 0, 0, 0.68);
  height: min(910px, calc(100vh - 48px));
  max-height: 910px;
  padding: 10px;
  position: relative;
  width: 434px;
}

.side-button,
.power-button {
  background: linear-gradient(180deg, #405463, #12212c);
  border: 1px solid #071018;
  position: absolute;
}

.side-button {
  border-radius: 3px 0 0 3px;
  right: 100%;
  width: 4px;
}

.side-button-top {
  height: 72px;
  top: 176px;
}

.side-button-bottom {
  height: 44px;
  top: 282px;
}

.power-button {
  border-radius: 0 3px 3px 0;
  height: 106px;
  left: 100%;
  top: 214px;
  width: 4px;
}

.device-screen {
  background: var(--canvas);
  border: 1px solid rgba(0, 0, 0, 0.92);
  border-radius: 56px;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.dynamic-island {
  background: #030405;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px #111820;
  height: 31px;
  left: 50%;
  position: absolute;
  top: 14px;
  transform: translateX(-50%);
  width: 116px;
  z-index: 20;
}

.dynamic-island::after {
  background: #08101b;
  border: 1px solid #101d2c;
  border-radius: 50%;
  box-shadow: inset 0 0 4px rgba(56, 92, 128, 0.8);
  content: "";
  height: 8px;
  position: absolute;
  right: 10px;
  top: 10px;
  width: 8px;
}

.ledger-app {
  background: var(--canvas);
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.ledger-app::-webkit-scrollbar {
  display: none;
}

.app-header {
  background:
    radial-gradient(circle at 100% 115%, rgba(31, 155, 184, 0.56), transparent 43%),
    linear-gradient(145deg, var(--blue-950), var(--blue-900));
  color: white;
  padding: 56px 18px 17px;
}

.title-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.title-row p,
.title-row h1 {
  margin: 0;
}

.title-row p {
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.title-row h1 {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 25px;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.cloud-state {
  align-items: center;
  background: rgba(3, 34, 53, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.76);
  display: flex;
  font-size: 10px;
  gap: 6px;
  padding: 8px 10px;
}

.cloud-state i {
  background: #49e58c;
  border-radius: 50%;
  box-shadow: 0 0 7px rgba(73, 229, 140, 0.72);
  height: 6px;
  width: 6px;
}

.logout-button {
  font-family: inherit;
}

.logout-button:hover {
  background: rgba(3, 34, 53, 0.62);
}

.gold-overview {
  align-items: center;
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.gold-overview > span {
  align-items: center;
  color: rgba(255, 255, 255, 0.9);
  display: inline-flex;
  font-size: 12px;
  gap: 3px;
  white-space: nowrap;
}

.gold-overview b {
  font-size: 13px;
}

.coin-icon {
  background:
    radial-gradient(circle at 35% 28%, #fff4a6 0 10%, transparent 11%),
    linear-gradient(138deg, #ffdf55 0%, #f3b91d 46%, #bd7702 100%);
  border: 1px solid #a76600;
  border-radius: 45% 52% 47% 50%;
  box-shadow:
    inset 1px 1px 0 rgba(255, 246, 174, 0.72),
    inset -2px -2px 2px rgba(136, 77, 0, 0.36),
    0 1px 2px rgba(41, 25, 0, 0.25);
  display: inline-block;
  flex: 0 0 auto;
  height: 17px;
  position: relative;
  transform: rotate(-13deg);
  width: 17px;
}

.coin-icon::before,
.coin-icon::after {
  border: 1px solid rgba(133, 77, 0, 0.35);
  border-radius: 50%;
  content: "";
  position: absolute;
}

.coin-icon::before {
  inset: 3px;
}

.coin-icon::after {
  background: rgba(255, 224, 100, 0.7);
  border: 0;
  height: 3px;
  left: 4px;
  top: 3px;
  width: 5px;
}

.main-tabs {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 52px;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.main-tabs button {
  background: transparent;
  border: 0;
  color: #92a0aa;
  font-size: 14px;
  font-weight: 700;
  position: relative;
}

.main-tabs button.active {
  color: var(--blue-900);
}

.main-tabs button.active::after {
  background: linear-gradient(90deg, #2787dd, #6757e9);
  border-radius: 999px;
  bottom: 0;
  content: "";
  height: 3px;
  left: 27%;
  position: absolute;
  right: 27%;
}

.app-content {
  padding: 14px;
}

.balance-card,
.content-card,
.operation-tabs,
.record-form {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 5px 16px rgba(22, 55, 77, 0.045);
}

.balance-card {
  align-items: center;
  background:
    radial-gradient(circle at 95% 0%, rgba(155, 129, 255, 0.66), transparent 35%),
    linear-gradient(116deg, #5b40bf 0%, #664bce 56%, #4c73d6 100%);
  border-color: rgba(255, 255, 255, 0.18);
  color: white;
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 15px 17px;
}

.balance-card p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  margin: 0 0 2px;
}

.balance-card > div > strong {
  font-family: "Arial Rounded MT Bold", Arial, sans-serif;
  font-size: 35px;
  letter-spacing: -0.03em;
  line-height: 1;
}

.balance-card > div > .coin-icon {
  margin-left: 7px;
  vertical-align: 2px;
}

.balance-card dl {
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  display: grid;
  gap: 7px;
  margin: 0;
  min-width: 105px;
  padding-left: 16px;
}

.balance-card dl div {
  align-items: center;
  display: flex;
  font-size: 10px;
  justify-content: space-between;
}

.balance-card dt {
  color: rgba(255, 255, 255, 0.63);
}

.balance-card dd {
  font-size: 12px;
  font-weight: 700;
  margin: 0;
}

.content-card {
  margin-top: 12px;
  padding: 13px 14px 4px;
}

.section-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
}

.section-heading h2 {
  align-items: center;
  display: flex;
  font-size: 13px;
  gap: 7px;
  margin: 0;
}

.section-heading h2::before {
  background: var(--green);
  border-radius: 50%;
  content: "";
  height: 7px;
  width: 7px;
}

.section-heading > span {
  color: #9aa8b2;
  font-size: 10px;
}

.section-heading button {
  background: transparent;
  border: 0;
  color: var(--blue-800);
  font-size: 10px;
  padding: 4px 0;
}

.member-grid {
  display: grid;
  gap: 0 18px;
  grid-template-columns: 1fr 1fr;
}

.member-item {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: 38px 1fr auto;
  min-height: 58px;
}

.member-item:nth-child(-n + 2) {
  border-top: 0;
}

.member-avatar {
  background: #eaf3f7;
  border: 2px solid #d4e3ea;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(19, 72, 104, 0.12);
  height: 38px;
  object-fit: cover;
  width: 38px;
}

.member-item > strong {
  color: var(--orange);
  font-size: 12px;
}

.member-item > b {
  color: var(--blue-900);
  font-family: "Arial Rounded MT Bold", Arial, sans-serif;
  font-size: 12px;
  white-space: nowrap;
}

.transaction-list {
  padding-bottom: 2px;
}

.transaction-item {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 9px;
  grid-template-columns: 32px 1fr auto;
  min-height: 56px;
}

.transaction-item:first-child {
  border-top: 0;
}

.transaction-icon {
  align-items: center;
  background: #edf5f9;
  border-radius: 50%;
  color: var(--blue-800);
  display: flex;
  font-size: 11px;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.transaction-icon.expense {
  background: #fff0ed;
  color: var(--red);
}

.transaction-item > div {
  min-width: 0;
}

.transaction-item > div strong,
.transaction-item > div span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transaction-item > div strong {
  font-size: 11px;
}

.transaction-item > div span {
  color: var(--muted);
  font-size: 9px;
  margin-top: 3px;
}

.transaction-item > b {
  color: var(--blue-900);
  font-family: "Arial Rounded MT Bold", Arial, sans-serif;
  font-size: 12px;
  white-space: nowrap;
}

.transaction-item > b.out {
  color: var(--red);
}

.record-heading {
  margin: 2px 2px 13px;
}

.record-heading h2,
.record-heading p {
  margin: 0;
}

.record-heading h2 {
  font-size: 18px;
}

.record-heading p {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}

.operation-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 12px;
  padding: 5px;
}

.operation-tabs button {
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: #8f9faa;
  font-size: 13px;
  font-weight: 700;
  padding: 11px;
}

.operation-tabs button.active.deposit {
  background: linear-gradient(115deg, #2489df, #5d60e8);
  box-shadow: 0 4px 10px rgba(50, 98, 216, 0.2);
  color: white;
}

.operation-tabs button.active.expense {
  background: linear-gradient(115deg, #e1665c, #d44a68);
  box-shadow: 0 4px 10px rgba(190, 58, 77, 0.18);
  color: white;
}

.record-form {
  overflow: hidden;
}

.form-row {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 64px 1fr;
  min-height: 62px;
  padding: 10px 15px;
}

.form-row:first-child {
  border-top: 0;
}

.form-row > span:first-child {
  color: #718493;
  font-size: 12px;
}

.form-row input,
.form-row select {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--ink);
  min-width: 0;
  outline: none;
  text-align: right;
  width: 100%;
}

.form-row select {
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.form-row input {
  font-size: 13px;
}

.form-row input::placeholder {
  color: #a6b2ba;
  opacity: 1;
}

.amount-row {
  min-height: 92px;
}

.amount-control {
  align-items: center;
  display: flex;
  justify-content: flex-end;
}

.amount-control input {
  color: var(--blue-900);
  font-family: "Arial Rounded MT Bold", Arial, sans-serif;
  font-size: 34px;
  font-weight: 800;
  margin-right: 8px;
}

.balance-tip {
  align-items: center;
  color: #81929f;
  display: flex;
  font-size: 10px;
  justify-content: space-between;
  padding: 11px 15px 0;
}

.balance-tip strong {
  color: var(--blue-800);
}

.save-button {
  background: linear-gradient(115deg, #2088dd, #5c61e7);
  border: 0;
  border-radius: 11px;
  box-shadow: 0 8px 18px rgba(45, 91, 194, 0.2);
  color: white;
  display: block;
  font-size: 14px;
  font-weight: 750;
  margin: 17px 14px 14px;
  padding: 14px;
  width: calc(100% - 28px);
}

.save-button.expense {
  background: linear-gradient(115deg, #e1665c, #d44a68);
}

.save-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.data-note {
  color: #9aa7b0;
  font-size: 10px;
  line-height: 1.6;
  margin: 12px 18px;
  text-align: center;
}

.notice {
  align-items: center;
  border: 1px solid;
  border-radius: 9px;
  display: flex;
  gap: 9px;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.notice p {
  flex: 1;
  font-size: 11px;
  margin: 0;
}

.notice button {
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 10px;
  text-decoration: underline;
}

.notice.error {
  background: #fff1ee;
  border-color: #f0c3bc;
  color: #bc5148;
}

.notice.success {
  background: #effaf4;
  border-color: #bfe6ce;
  color: #2d8f56;
}

.loading-state {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 11px;
  justify-content: center;
  min-height: 360px;
}

.loading-state .coin-icon {
  animation: coin-pulse 1.3s ease-in-out infinite;
  height: 32px;
  width: 32px;
}

@keyframes coin-pulse {
  50% {
    box-shadow: 0 0 18px rgba(239, 184, 45, 0.42);
    transform: rotate(-13deg) translateY(-3px);
  }
}

.auth-app {
  background:
    radial-gradient(circle at 50% 38%, rgba(224, 238, 247, 0.9), transparent 36%),
    var(--canvas);
}

.auth-header {
  min-height: 128px;
}

.auth-loading {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 12px;
  justify-content: center;
  min-height: 520px;
}

.auth-loading .coin-icon {
  animation: coin-pulse 1.3s ease-in-out infinite;
  height: 32px;
  width: 32px;
}

.login-view {
  margin: 0 auto;
  max-width: 350px;
  padding: 54px 22px 24px;
  text-align: center;
}

.login-emblem {
  align-items: center;
  background:
    radial-gradient(circle at 36% 26%, rgba(255, 255, 255, 0.42), transparent 18%),
    linear-gradient(145deg, #f7cb42, #ca7a08);
  border: 3px solid #f5d872;
  border-radius: 24px;
  box-shadow:
    0 10px 24px rgba(136, 83, 5, 0.22),
    inset 0 0 0 2px rgba(126, 68, 0, 0.4);
  color: #5b3300;
  display: flex;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 36px;
  font-weight: 900;
  height: 76px;
  justify-content: center;
  margin: 0 auto 20px;
  transform: rotate(-3deg);
  width: 76px;
}

.login-heading p,
.login-heading h2,
.login-heading span {
  margin: 0;
}

.login-heading p {
  color: var(--orange);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.login-heading h2 {
  color: var(--ink);
  font-size: 24px;
  margin-top: 5px;
}

.login-heading span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 6px;
}

.login-form {
  margin-top: 24px;
}

.login-form label {
  background: white;
  border: 1px solid #dce5eb;
  border-radius: 12px;
  display: block;
  padding: 11px 14px 12px;
  text-align: left;
}

.login-form label > span {
  color: #7c8d99;
  display: block;
  font-size: 10px;
  margin-bottom: 5px;
}

.login-form input {
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 17px;
  outline: 0;
  padding: 0;
  width: 100%;
}

.login-form input::placeholder {
  color: #b0bbc3;
}

.login-form > button {
  background: linear-gradient(115deg, #126e9e, #0b4d73);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(15, 84, 120, 0.2);
  color: white;
  font-size: 14px;
  font-weight: 800;
  margin-top: 12px;
  padding: 14px;
  width: 100%;
}

.login-form > button:disabled {
  cursor: wait;
  opacity: 0.52;
}

.login-error {
  color: var(--red);
  font-size: 11px;
  margin: 9px 2px 0;
  text-align: left;
}

.login-note {
  color: #93a2ad;
  font-size: 10px;
  line-height: 1.6;
  margin: 16px 12px 0;
}

@media (max-width: 540px) {
  body {
    background: var(--canvas);
  }

  .device-stage {
    display: block;
    min-height: 100vh;
    padding: 0;
  }

  .iphone-frame {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    height: 100vh;
    max-height: none;
    padding: 0;
    width: 100%;
  }

  .side-button,
  .power-button,
  .dynamic-island {
    display: none;
  }

  .device-screen {
    border: 0;
    border-radius: 0;
  }

  .app-header {
    padding-top: max(22px, env(safe-area-inset-top));
  }

  .auth-header {
    min-height: 96px;
  }

  .login-view {
    padding-top: 62px;
  }
}

@media (max-width: 360px) {
  .gold-overview {
    gap: 8px;
  }

  .gold-overview > span {
    font-size: 11px;
  }

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

  .member-item:nth-child(2) {
    border-top: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }

  .loading-state .coin-icon {
    animation: none;
  }

  .auth-loading .coin-icon {
    animation: none;
  }
}

#app {
  min-height: 100vh;
}

.header-actions {
  align-items: center;
  display: flex;
  gap: 6px;
}

.backup-button,
.logout-button {
  align-items: center;
  background: rgba(3, 34, 53, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.82);
  display: inline-flex;
  font-size: 10px;
  padding: 8px 10px;
}

.backup-button:hover,
.logout-button:hover {
  background: rgba(3, 34, 53, 0.62);
}

.member-avatar {
  display: block;
}

.admin-login-view {
  padding-top: 30px;
}

.admin-section-tabs {
  background: #e9eef3;
  border-radius: 11px;
  display: grid;
  gap: 4px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 14px;
  padding: 4px;
}

.admin-section-tabs button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #82929e;
  font-size: 12px;
  font-weight: 750;
  padding: 10px;
}

.admin-section-tabs button.active {
  background: white;
  box-shadow: 0 3px 9px rgba(22, 55, 77, 0.08);
  color: var(--blue-900);
}

.add-member-form {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  overflow: hidden;
}

.add-member-form label {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 82px 1fr;
  min-height: 54px;
  padding: 8px 14px;
}

.add-member-form label span {
  color: #718493;
  font-size: 11px;
}

.add-member-form input {
  background: transparent;
  border: 0;
  color: var(--ink);
  outline: 0;
  text-align: right;
}

.add-member-form > button {
  background: linear-gradient(115deg, #2088dd, #5c61e7);
  border: 0;
  color: white;
  font-size: 13px;
  font-weight: 750;
  padding: 13px;
}

.member-admin-list {
  padding: 5px 13px;
}

.member-admin-item {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 9px;
  grid-template-columns: 38px 1fr auto;
  min-height: 72px;
}

.member-admin-item:first-child {
  border-top: 0;
}

.member-admin-item.inactive {
  opacity: 0.55;
}

.member-admin-item > div:nth-child(2) {
  min-width: 0;
}

.member-admin-item > div > strong,
.member-admin-item > div > span {
  display: block;
}

.member-admin-item > div > strong {
  color: var(--orange);
  font-size: 12px;
}

.member-admin-item > div > span {
  color: var(--muted);
  font-size: 9px;
  margin-top: 3px;
}

.member-admin-actions {
  align-items: center;
  display: flex;
  gap: 3px;
}

.member-admin-actions button,
.avatar-upload {
  background: #edf4f8;
  border: 0;
  border-radius: 6px;
  color: var(--blue-800);
  cursor: pointer;
  font-size: 9px;
  padding: 6px;
  white-space: nowrap;
}

.member-admin-actions button.danger {
  background: #fff0ed;
  color: var(--red);
}

.avatar-upload input {
  display: none;
}

.member-avatar-fallback {
  align-items: center;
  color: var(--blue-800);
  display: flex;
  font-family: "Kaiti SC", "STKaiti", serif;
  font-size: 16px;
  font-weight: 800;
  justify-content: center;
}

.empty-state {
  color: var(--muted);
  font-size: 11px;
  padding: 28px 0;
  text-align: center;
}

.record-form .save-button {
  line-height: normal;
}

.debt-value,
.member-item.in-debt > b,
.member-admin-item.in-debt > div > span {
  color: var(--red);
}

.coin-icon {
  background: url("/gold-coin.avif") center / 108% 108% no-repeat;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(41, 25, 0, 0.28);
  overflow: hidden;
}

.coin-icon::before,
.coin-icon::after {
  display: none;
}

@media (max-width: 360px) {
  .backup-button {
    display: none;
  }
}
