:root {
  --primary: #FF4B72;
  --primary-light: #FFF0F3;
  --bg: #F8F9FA;
  --card-bg: #FFFFFF;
  --text-main: #1C1C1E;
  --text-sub: #8E8E93;
  --border: #E5E5EA;
  --safe-bottom: env(safe-area-inset-bottom, 16px);
  --safe-top: env(safe-area-inset-top, 20px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
  background-color: var(--bg); color: var(--text-main); line-height: 1.4; user-select: none;
}
.mobile-container {
  display: flex; flex-direction: column; height: 100vh; max-width: 480px; margin: 0 auto;
  position: relative; background: var(--bg);
}
.app-header {
  padding: calc(var(--safe-top) + 8px) 16px 10px 16px; background: #ffffffdd;
  backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.header-content { display: flex; justify-content: space-between; align-items: center; }
.header-title { font-size: 19px; font-weight: 700; color: var(--primary); letter-spacing: -0.5px; }
.status-pill { font-size: 11px; padding: 3px 8px; border-radius: 10px; background: var(--primary-light); color: var(--primary); font-weight: 600; }
.main-content {
  flex: 1; overflow-y: auto; padding: 14px; padding-bottom: calc(var(--safe-bottom) + 65px);
}
.view-panel { display: none; }
.view-panel.active { display: block; animation: fadeIn 0.15s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.card {
  background: var(--card-bg); border-radius: 16px; padding: 16px; margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-sub); margin-bottom: 6px; }
.amount-input-wrapper {
  display: flex; align-items: center; background: #F2F2F7; border-radius: 12px; padding: 8px 14px;
}
.currency-symbol { font-size: 24px; font-weight: 700; color: var(--primary); margin-right: 6px; }
.amount-input-wrapper input {
  border: none; background: transparent; font-size: 26px; font-weight: 700; width: 100%; color: var(--text-main); outline: none;
}
.segment-control { display: flex; background: #E5E5EA; border-radius: 10px; padding: 2px; }
.segment-btn {
  flex: 1; padding: 8px 0; border: none; background: transparent; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-sub); cursor: pointer;
}
.segment-btn.active { background: #fff; color: var(--text-main); box-shadow: 0 2px 5px rgba(0,0,0,0.08); }
.split-options { display: flex; flex-direction: column; gap: 6px; }
.radio-card {
  display: flex; align-items: flex-start; padding: 10px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
}
.radio-card input { margin-right: 8px; margin-top: 2px; accent-color: var(--primary); }
.radio-card.active { background: var(--primary-light); border-color: var(--primary); }
.radio-title { display: block; font-size: 13px; font-weight: 600; color: var(--text-main); }
.radio-desc { display: block; font-size: 11px; color: var(--text-sub); }
.custom-select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; font-size: 14px; color: var(--text-main); outline: none;
}
.primary-btn, .settle-btn {
  width: 100%; padding: 12px; border-radius: 12px; border: none; background: var(--primary);
  color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; box-shadow: 0 3px 10px rgba(255, 75, 114, 0.25);
}
.primary-btn:active, .settle-btn:active { opacity: 0.9; transform: scale(0.99); }
.summary-card { background: linear-gradient(135deg, #FF4B72, #FF758C); color: #fff; }
.summary-row { display: flex; justify-content: space-around; align-items: center; }
.summary-item { display: flex; flex-direction: column; align-items: center; }
.summary-sub { font-size: 11px; opacity: 0.85; }
.summary-val { font-size: 22px; font-weight: 800; margin: 2px 0; }
.summary-note { font-size: 11px; opacity: 0.85; }
.summary-divider { width: 1px; height: 36px; background: rgba(255, 255, 255, 0.3); }
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.card-desc { font-size: 11px; color: var(--text-sub); margin-bottom: 10px; }
.rank-item { display: flex; flex-direction: column; margin-bottom: 10px; }
.rank-header { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 3px; }
.rank-bar-bg { height: 6px; background: #E5E5EA; border-radius: 3px; overflow: hidden; }
.rank-bar-fill { height: 100%; background: var(--primary); border-radius: 3px; }
.contributor-item {
  display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #F2F2F7;
}
.contributor-name { font-weight: 600; font-size: 13px; }
.contributor-stats { font-size: 11px; color: var(--text-sub); text-align: right; }
.settle-box { background: #F2F2F7; border-radius: 12px; padding: 14px; margin-bottom: 12px; text-align: center; font-size: 13px; }
.empty-state { text-align: center; font-size: 12px; color: var(--text-sub); padding: 12px 0; }
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto;
  height: calc(var(--safe-bottom) + 50px); padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(20px); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: center; z-index: 100;
}
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; border: none;
  background: transparent; color: var(--text-sub); cursor: pointer; padding: 4px 0;
}
.tab-item.active { color: var(--primary); }
.tab-icon { font-size: 17px; margin-bottom: 2px; }
.tab-label { font-size: 10px; font-weight: 600; }
.couple-subtitle { font-size: 11px; color: var(--text-sub); margin-top: 1px; font-weight: 500; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.15s ease-in-out; }
.modal-card {
  background: #fff; width: 100%; max-width: 380px; border-radius: 20px;
  padding: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-main); }
.modal-close { border: none; background: transparent; font-size: 24px; color: var(--text-sub); cursor: pointer; }
.modal-input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  font-size: 14px; color: var(--text-main); outline: none; background: #F8F9FA;
}
.pair-code-box {
  background: var(--primary-light); border-radius: 10px; padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.pair-code-label { font-size: 12px; color: var(--primary); font-weight: 600; }
.pair-code-val { font-size: 15px; font-weight: 800; color: var(--primary); letter-spacing: 1.5px; }

/* 智能时区路由与事后记账样式 */
.section-header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.mini-badge {
  font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--primary-light);
  color: var(--primary); font-weight: 600;
}
.route-tip-box {
  display: flex; align-items: flex-start; gap: 6px; background: #F2F2F7;
  border-radius: 10px; padding: 8px 10px; margin-top: 8px; font-size: 12px; color: #3C3C43;
}
.route-tip-box.manual { background: #FFF9E6; color: #856404; }
.route-tip-icon { font-size: 14px; line-height: 1.2; }
.text-action-btn {
  border: none; background: transparent; font-size: 11px; color: var(--primary);
  font-weight: 600; cursor: pointer; padding: 0 4px;
}
.time-input-row { display: flex; width: 100%; margin-bottom: 6px; }
.custom-datetime-input {
  width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; font-size: 13px; color: var(--text-main); outline: none; font-family: inherit;
}
.quick-dates-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.date-chip {
  flex-shrink: 0; padding: 4px 10px; border-radius: 14px; border: 1px solid var(--border);
  background: #F8F9FA; font-size: 11px; font-weight: 600; color: var(--text-sub); cursor: pointer;
}
.date-chip:active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* 近期明细列表与编辑按钮样式 */
.tx-history-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.tx-history-item {
  display: flex; justify-content: space-between; align-items: center; padding: 10px 12px;
  background: #F9FAFB; border-radius: 12px; border: 1px solid var(--border);
}
.tx-item-left { display: flex; flex-direction: column; gap: 3px; }
.tx-item-cat { font-size: 14px; font-weight: 700; color: var(--text-main); }
.tx-item-meta { font-size: 11px; color: var(--text-sub); }
.tx-item-right { display: flex; align-items: center; gap: 10px; }
.tx-item-amount { font-size: 15px; font-weight: 800; color: var(--text-main); }
.btn-edit-inline {
  padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; font-size: 11px; font-weight: 600; color: var(--primary); cursor: pointer;
}
.btn-edit-inline:active { background: var(--primary-light); }
.modal-actions-row { display: flex; gap: 10px; margin-top: 14px; }
.danger-btn {
  flex: 1; padding: 12px; border-radius: 12px; border: 1px solid #FF3B30;
  background: #FFF2F2; color: #FF3B30; font-size: 14px; font-weight: 700; cursor: pointer;
}
.danger-btn:active { background: #FFE5E5; }
.ledger-filter-segment { margin-bottom: 12px; }

/* 备注输入框与明细展示 */
.custom-input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; font-size: 14px; color: var(--text-main); outline: none; font-family: inherit;
}
.custom-input:focus, .custom-select:focus, .custom-datetime-input:focus, .modal-input:focus {
  border-color: var(--primary);
}
.tx-item-notes {
  font-size: 11px; color: #555; background: #EEF2F6; padding: 2px 6px;
  border-radius: 4px; display: inline-block; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
