:root {
  --bg: #fff7f4;
  --bg-grad: radial-gradient(circle at 15% 15%, #ffdbe6 0%, #fff7f4 50%, #fef4e8 100%);
  --surface: #ffffffcc;
  --text: #54424a;
  --soft-text: #8a7079;
  --main: #ff6f9f;
  --main-strong: #f85e92;
  --ok: #34b57c;
  --warn: #f9a825;
  --border: #f2d5df;
  --shadow: 0 10px 24px rgba(255, 111, 159, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-grad);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px calc(88px + env(safe-area-inset-bottom));
}

.page {
  margin-top: 12px;
}

.hero {
  background: linear-gradient(130deg, #ffe2ec, #fff1d8);
  border: 1px solid #ffd6e4;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 16px;
}

.hero__top {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 8px;
}

.monthSwitcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff9fbcc;
  border: 1px solid #ffd7e5;
  border-radius: 999px;
  padding: 5px 7px;
  backdrop-filter: blur(4px);
}

.monthBtn {
  border: 0;
  background: #ffe7f1;
  color: #c15580;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.monthDisplay {
  border: 0;
  background: #fff;
  color: #735865;
  min-width: 140px;
  height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  font-size: 0.9rem;
  border: 1px solid #ffd3e1;
  font-weight: 600;
  cursor: pointer;
}

.monthDisplay__caret {
  font-size: 0.8rem;
  color: #bd6f90;
}

.monthNative {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.hero h1 {
  margin: 4px 0 8px;
  font-size: 1.45rem;
}

.hero__tag {
  margin: 0;
  color: #d85f8b;
  font-weight: 700;
  font-size: 0.88rem;
}

.hero__hint {
  margin: 0;
  color: var(--soft-text);
  font-size: 0.95rem;
}

.summary {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.summary__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  backdrop-filter: blur(2px);
}

.summary__card p {
  margin: 0;
  color: var(--soft-text);
  font-size: 0.9rem;
}

.summary__card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
  color: var(--main-strong);
}

.summary__card--wait strong {
  color: var(--warn);
}

.summary__card--paid strong {
  color: var(--ok);
}

.summary__card--count strong {
  color: #7a5f69;
}

.composer,
.records,
.cloud {
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  backdrop-filter: blur(2px);
}

.composer h2,
.records h2,
.cloud h2 {
  margin: 0 0 8px;
  font-size: 1.02rem;
}

.cloud__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.syncBadge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.8rem;
  border: 1px solid #ffd2e1;
  color: #a15b7a;
  background: #fff1f7;
}

.syncBadge[data-state="ok"] {
  border-color: #9adfbe;
  color: #277e58;
  background: #eafff3;
}

.syncBadge[data-state="warn"] {
  border-color: #ffd39c;
  color: #9f6a06;
  background: #fff7ea;
}

.syncBadge[data-state="error"] {
  border-color: #f8b3b3;
  color: #aa3434;
  background: #fff1f1;
}

.cloud__meta {
  margin: 4px 0 10px;
  font-size: 0.86rem;
  color: var(--soft-text);
}

.cloudActions {
  display: flex;
  gap: 8px;
}

.cloudActions .btn--main {
  flex: 1;
}

.cloudActions--secondary {
  margin-top: 8px;
}

.cloudActions--secondary .btn {
  flex: 1;
}

.cloudGrid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.composer__tips {
  margin: 0 0 10px;
  color: var(--soft-text);
  font-size: 0.84rem;
  line-height: 1.5;
}

.composer__tips span {
  background: #fff2f7;
  border: 1px dashed #ffc5d8;
  padding: 2px 7px;
  border-radius: 999px;
}

textarea,
input[type="text"],
input[type="date"],
input[type="number"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.97rem;
  color: var(--text);
  background: #fff;
}

textarea:focus,
input:focus {
  outline: none;
  border-color: #f7a3bf;
  box-shadow: 0 0 0 3px rgba(255, 111, 159, 0.15);
}

.composer__actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 0.95rem;
}

.btn--main {
  background: var(--main);
  color: #fff;
  font-weight: 700;
  flex: 1;
}

.btn--soft {
  background: #fff0f6;
  color: #cc4e7d;
  border: 1px solid #ffc6db;
}

.preview {
  margin-top: 12px;
  border-top: 1px dashed #f0c4d4;
  padding-top: 10px;
}

.preview h3 {
  margin: 0 0 8px;
  font-size: 0.93rem;
  color: #815d6a;
}

.formGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.formGrid label {
  font-size: 0.86rem;
  color: var(--soft-text);
}

.formGrid__full {
  grid-column: 1 / -1;
}

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

.toolbar {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.chip {
  border: 1px solid #ffc9db;
  background: #fff7fa;
  color: #b95f82;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.86rem;
}

.chip.is-active {
  background: var(--main);
  color: #fff;
  border-color: var(--main);
}

.recordList {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 9px;
}

.recordItem {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
}

.recordTop {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.recordTitle {
  margin: 0;
  font-weight: 700;
}

.recordAmount {
  margin: 0;
  color: #ca4b7f;
  font-weight: 700;
}

.recordBottom {
  margin-top: 4px;
  display: flex;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--soft-text);
}

.recordState {
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid;
}

.recordState[data-paid="true"] {
  color: var(--ok);
  border-color: #86dfb7;
  background: #e9fff3;
}

.recordState[data-paid="false"] {
  color: #c17b0d;
  border-color: #f8d08b;
  background: #fff8e7;
}

.recordNote {
  margin: 6px 0 0;
  color: #856974;
  font-size: 0.85rem;
}

.recordActions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.togglePaid,
.editBtn,
.deleteBtn {
  border: 0;
  border-radius: 9px;
  padding: 6px 8px;
  font-size: 0.8rem;
}

.editBtn {
  background: #eef4ff;
  color: #4f6ab6;
}

.togglePaid {
  background: #ecfff5;
  color: #2d8e63;
}

.togglePaid[data-paid="false"] {
  background: #fff7ea;
  color: #af780f;
}

.deleteBtn {
  background: #fff0f0;
  color: #b94242;
}

.emptyTip {
  margin: 10px 0 2px;
  text-align: center;
  color: var(--soft-text);
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(760px, 100%);
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, #fff3f8 60%, #fff3f800);
  display: flex;
  gap: 8px;
  z-index: 20;
}

.tabbar__btn {
  flex: 1;
  border: 1px solid #ffc9db;
  background: #fffafc;
  color: #b45d80;
  border-radius: 12px;
  height: 42px;
  font-size: 0.95rem;
  font-weight: 700;
}

.tabbar__btn.is-active {
  background: var(--main);
  border-color: var(--main);
  color: #fff;
}

.editDialog {
  border: 1px solid #ffd7e4;
  border-radius: 16px;
  max-width: 520px;
  width: calc(100% - 24px);
  padding: 0;
  background: #fffafc;
}

.editDialog::backdrop {
  background: rgba(57, 26, 39, 0.28);
}

.editForm {
  padding: 14px;
}

.editForm h3 {
  margin: 2px 0 10px;
  color: #7c5d69;
}

.dialogActions {
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

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

  .cloudActions {
    flex-direction: column;
  }

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

  .dialogActions {
    flex-direction: column;
  }
}
