:root {
  color-scheme: light;
  --bg: #fff7f9;
  --panel: #ffffff;
  --panel-soft: #fff7f9;
  --panel-ghost: #fff8fa;
  --text: #5c182a;
  --muted: #8e5160;
  --line: #e8cfd7;
  --brand: #be536c;
  --brand-2: #e59aaa;
  --shadow: 0 18px 38px rgba(191, 113, 136, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background: linear-gradient(180deg, #fffdfd 0%, #fff7fa 26%, #fff2f6 100%);
  color: var(--text);
}
.fatal-screen {
  margin: 0;
  min-height: 100vh;
  padding: 24px 18px;
  background: linear-gradient(180deg, #fffdfd 0%, #fff7fa 26%, #fff2f6 100%);
  color: var(--text);
  white-space: pre-wrap;
  font: 14px/1.6 "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
}
button { font: inherit; }
.app-shell {
  width: 100%;
  max-width: 390px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 16px 104px;
  background: linear-gradient(180deg, #fffafc 0%, var(--bg) 100%);
  position: relative;
  box-shadow: 0 0 0 1px rgba(232, 207, 215, 0.45);
}
@media (max-width: 640px) {
  .app-shell {
    max-width: none;
    box-shadow: none;
  }
}
.build-badge {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.screen { display: grid; gap: 14px; }
.screen-header { display: grid; gap: 10px; }
.screen-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.title-wrap { display: grid; gap: 6px; }
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.screen-title, .section-title, .card-title, .summary-title {
  margin: 0;
}
.screen-title {
  font-size: 28px;
  line-height: 1.1;
}
.section-title {
  font-size: 18px;
  line-height: 1.2;
}
.chip, .hero-badge, .summary-kind, .summary-status, .info-badge, .calendar-picker, .search-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
}
.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
}
.chip.ghost {
  gap: 8px;
}
.chip.soft, .hero-badge, .summary-status, .info-badge {
  background: #fff4f7;
  color: var(--brand);
}
.chip.outline {
  border: 1px solid var(--line);
  background: #ffffff;
}
.hero-card, .summary-card, .info-card, .list-card, .helper-card, .compact-card, .calendar-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
}
.hero-card {
  padding: 20px 18px;
  display: grid;
  gap: 12px;
  color: #fff;
  background: linear-gradient(180deg, #cb5f78 0%, var(--brand-2) 100%);
  box-shadow: 0 20px 40px rgba(191, 113, 136, 0.24);
}
.hero-top, .info-top, .debt-row, .list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.hero-label {
  color: #fff7f9;
  font-size: 14px;
  font-weight: 700;
}
.hero-badge {
  background: rgba(255, 244, 247, 0.95);
}
.hero-amount {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
}
.hero-meta, .summary-meta, .card-copy, .list-row-meta, .debt-subtle {
  margin: 0;
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  line-height: 1.45;
}
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.stat-box {
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 16px;
  display: grid;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(230, 204, 212, 0.18);
}
.stat-box.soft {
  background: #fff4f7;
}
.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.stat-value, .debt-amount {
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
}
.filter-tabs, .mini-chip-row, .action-row {
  display: flex;
  gap: 8px;
}
.filter-tabs { flex-wrap: wrap; }
.filter-tabs-vertical {
  flex-direction: column;
  flex-wrap: nowrap;
}
.filter-tabs-vertical .filter-chip {
  width: 100%;
  justify-content: flex-start;
}
.filter-chip, .wide-ghost-button, .action-primary, .action-secondary, .search-card, .nav-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  color: var(--muted);
  padding: 10px 14px;
}
.filter-chip.is-active, .action-primary, .nav-item.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.wide-ghost-button, .search-card, .action-primary, .action-secondary {
  width: 100%;
}
.summary-card {
  padding: 16px;
  display: grid;
  gap: 10px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(223, 192, 201, 0.22);
}
.summary-kind {
  justify-self: start;
  padding: 6px 10px;
  background: #fff3f6;
}
.summary-title {
  font-size: 16px;
  color: var(--text);
}
.summary-meta, .card-copy, .list-row-meta, .debt-subtle {
  color: #8b6270;
}
.summary-status {
  justify-self: start;
  background: #fff1f5;
  color: #9f435a;
}
.mini-chip {
  flex: 1;
  text-align: center;
  padding: 8px 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fffdfd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.info-card, .helper-card {
  padding: 18px;
  display: grid;
  gap: 10px;
}
.form-card {
  gap: 12px;
}
.form-field {
  display: grid;
  gap: 8px;
}
.form-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.form-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}
.field-hint {
  margin-top: -2px;
  padding: 0 4px;
  color: #a06d7c;
  font-size: 11px;
  line-height: 1.45;
}
.form-textarea {
  resize: vertical;
  min-height: 88px;
}
.list-card {
  padding: 18px;
  display: grid;
  gap: 10px;
}
.list-row {
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #ffffff;
}
.list-row.is-clickable {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.list-row.is-clickable:hover,
.list-row.is-clickable:focus-visible {
  border-color: #d78ca0;
  box-shadow: 0 10px 24px rgba(214, 151, 168, 0.18);
  transform: translateY(-1px);
  outline: none;
}
.list-row.is-clickable:active {
  transform: translateY(0);
}
.list-row-left {
  display: grid;
  gap: 4px;
}
.list-row-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.list-row-title {
  color: var(--text);
  font-size: 14px;
}
.list-row-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  background: #f6e2e8;
  color: #9a6473;
}
.list-row-badge.success {
  background: #e2f3ea;
  color: #4c9a74;
}
.list-row-badge.soft {
  background: #e4eef5;
  color: #4f7f9d;
}
.list-row-badge.danger {
  background: #ffe1e8;
  color: #c45b74;
}
.list-row-badge.muted {
  background: #f6e2e8;
  color: #9a6473;
}
.list-row-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
}
.list-row-amount.success { color: #4c9a74; }
.list-row-amount.soft { color: #4f7f9d; }
.list-row-amount.danger { color: #c45b74; }
.list-row-amount.muted { color: #a88a95; }
.compact-card {
  padding: 16px 18px;
}
.debt-row-left {
  display: grid;
  gap: 6px;
}
.calendar-card {
  padding: 14px 12px;
  display: grid;
  gap: 10px;
  background: linear-gradient(180deg, #fff6f8 0%, #fffefe 100%);
  border-color: #efcfd9;
  box-shadow: 0 14px 30px rgba(227, 196, 205, 0.2);
}
.calendar-top, .calendar-week, .calendar-grid, .calendar-legend {
  display: grid;
  gap: 6px;
}
.calendar-top {
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.calendar-nav, .calendar-picker {
  color: #855060;
  font-size: 11px;
  font-weight: 700;
}
.calendar-nav {
  border: none;
  background: transparent;
  padding: 0;
  width: max-content;
  justify-self: start;
  text-align: left;
}
.calendar-nav:last-child {
  justify-self: end;
  text-align: right;
}
.calendar-picker {
  border: 1px solid #eed5dd;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(229, 205, 213, 0.18);
}
.calendar-week, .calendar-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.calendar-weekday, .calendar-day {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
}
.calendar-weekday { color: #a56778; }
.calendar-day {
  color: #7f5865;
  padding: 4px 0;
  border: none;
  width: 100%;
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.calendar-day:hover {
  background: rgba(255, 224, 232, 0.64);
}
.calendar-day:focus-visible {
  outline: 2px solid #f1afc0;
  outline-offset: 2px;
}
.calendar-day.is-muted { color: #cda2af; }
.calendar-day.is-due {
  border-radius: 999px;
  background: #ffe5ec;
  color: #9f435a;
}
.calendar-day.is-nearest {
  border-radius: 999px;
  background: #ffb8cb;
  color: #8d1f42;
  box-shadow: inset 0 0 0 1px rgba(189, 75, 109, 0.18);
}
.calendar-day.is-today {
  border-radius: 999px;
  background: #ffd1dd;
  color: #9f2948;
  box-shadow: inset 0 0 0 1px rgba(194, 96, 122, 0.12);
}
.calendar-legend {
  grid-template-columns: repeat(2, minmax(0, max-content));
}
.calendar-summary {
  margin: 2px 4px 0;
  color: #9a6473;
  font-size: 11px;
  line-height: 1.45;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #8f5a68;
  font-size: 10px;
  font-weight: 700;
}
.legend-item::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ffdce6;
}
.legend-item.today::before {
  background: #ffb8cb;
  border: 1px solid #ffcfdc;
}
.legend-item.nearest::before {
  background: #ffb8cb;
  border: 1px solid rgba(189, 75, 109, 0.2);
}
.search-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
}
.search-label {
  color: #94616f;
  font-weight: 700;
}
.search-chip {
  padding: 6px 10px;
}
.bottom-nav {
  position: sticky;
  bottom: 0;
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 0 0;
  background: linear-gradient(180deg, rgba(255,248,250,0), rgba(255,250,252,0.98) 40%);
}
.nav-item {
  padding: 12px 8px;
  font-size: 12px;
  font-weight: 700;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 94px;
  transform: translateX(-50%);
  background: rgba(111, 32, 53, 0.92);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
}
.toast.is-visible { opacity: 1; }
