/* 「我们」双人私密 App — 样式（方案 A：奶油甜日）
 * 颜色 / 圆角 / 间距全部集中在 :root，换设计只改这里。
 */

/* 去掉 Netlify 免费版注入的推广浮层 */
#nl-badge-frame,
iframe#nl-badge-frame {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* 照片墙：删除角标 + 添加格子 */
@keyframes phIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: none; }
}
@keyframes secIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}
.photo-grid .ph-wrap,
.photo-grid .ph-add { animation: phIn 0.28s ease both; }
.sec { animation: secIn 0.22s ease both; }

.ph-wrap { position: relative; }
.ph-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 15px;
  line-height: 22px;
  text-align: center;
  padding: 0;
  cursor: pointer;
}
.ph-add {
  border: 1.5px dashed var(--empty-dash, #D9CEC3);
  background: transparent;
  color: var(--muted);
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

:root {
  /* 颜色 */
  --bg: #FBF7F2;
  --card: #FFFFFF;
  --line: #EFE6DC;
  --text: #3A3330;
  --muted: #8C817B;
  --me: #6BA383;
  --partner: #E7A0AE;
  --accent: #F2B880;

  /* 派生浅色 */
  --me-soft: #ECF4EF;
  --partner-soft: #FBEDF0;
  --accent-soft: #FDF2E4;
  --chip-bg: #F6F0E9;
  --field-bg: #FBF7F2;

  /* 其它调色（也集中在这里，方便整体换皮） */
  --placeholder: #B5A9A0;
  --seg-bg: #F3ECE3;
  --track-bg: #F1E8DE;
  --dash: #D9CCBF;
  --empty-dash: #DCCFC2;
  --upcoming-ink: #9A6C35;
  --pending-ink: #A9772F;
  --src-note-ink: #B3823F;
  --src-photo-bg: #EFF2FA;
  --src-photo-ink: #6A7EAE;
  --src-ledger-ink: #B96F80;
  --src-profile-bg: #F2EEF8;
  --src-profile-ink: #8168A8;
  --sk-base: #F3ECE3;
  --sk-shine: #FAF5EE;
  --desktop-bg: #F4EDE5;
  --viewer-bg: #141110;
  --viewer-muted: #C9BDB3;
  --viewer-delete: #FFD9D9;
  --mask: rgba(58, 51, 48, .34);
  --tabbar-bg: rgba(251, 247, 242, .94);
  --toast-bg: rgba(58, 51, 48, .93);

  /* 圆角 */
  --radius-card: 22px;
  --radius-btn: 14px;
  --radius-pill: 999px;
  --radius-photo: 14px;

  /* 间距 */
  --space-page: 20px;
  --space-card: 20px;
  --space-gap: 16px;
  --nav-h: 60px;

  /* 阴影 / 字体 / 安全区 */
  --shadow-card: 0 2px 10px rgba(58, 51, 48, .05), 0 10px 28px rgba(58, 51, 48, .04);
  --shadow-float: 0 10px 24px rgba(107, 163, 131, .28);
  --font-title: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-num: "SF Pro Display", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============ 基础 ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
svg { display: block; }
.hidden { display: none !important; }
.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;
}
.noscript { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ============ 启动 / 登录 ============ */
.boot {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px;
  padding-top: var(--safe-top);
}
.login {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  max-width: 480px; margin: 0 auto;
  padding: calc(28px + var(--safe-top)) var(--space-page) calc(28px + var(--safe-bottom));
}
.login-inner { width: 100%; }
.login-brand { text-align: center; margin-bottom: 26px; }
.brand-heart { width: 46px; height: 46px; margin: 0 auto 12px; fill: var(--partner); }
.login-brand h1 {
  font-family: var(--font-title);
  font-size: 34px; font-weight: 600; letter-spacing: .12em;
  margin-left: .12em;
}
.login-brand p { color: var(--muted); font-size: 13px; margin-top: 6px; letter-spacing: .08em; }
.notice {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #8A6A45;
  line-height: 1.65;
}
.notice strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
.notice code {
  background: rgba(255, 255, 255, .7);
  border-radius: 5px;
  padding: 1px 5px;
  font-family: var(--font-num);
  font-size: 12px;
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.account-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.account {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px 16px 14px;
  text-align: left;
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.account:active { transform: scale(.98); }
.account.active {
  border-color: var(--me);
  box-shadow: 0 6px 18px rgba(107, 163, 131, .14);
}
.account-initial {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--me-soft); color: var(--me);
  font-family: var(--font-title); font-size: 16px;
  margin-bottom: 6px;
}
.account[data-account="ge"] .account-initial { background: var(--partner-soft); color: var(--partner); }
.account.active[data-account="ge"] { border-color: var(--partner); box-shadow: 0 6px 18px rgba(231, 160, 174, .2); }
.account-name { font-size: 15px; font-weight: 600; }
.account-mail { font-size: 11px; color: var(--muted); }
.login-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 2px; }
.login-form .input:disabled, .login-form .btn-primary:disabled, .login-form .account:disabled { opacity: .55; }

/* ============ 通用控件 ============ */
.input {
  width: 100%;
  min-width: 0;
  height: 46px;
  background: var(--field-bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-btn);
  padding: 0 14px;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
  -webkit-appearance: none;
}
.input:focus { border-color: var(--me); box-shadow: 0 0 0 3px rgba(107, 163, 131, .12); }
select.input { background-image: none; padding-right: 30px; }
input[type="date"].input { line-height: 44px; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border-radius: var(--radius-btn);
  background: var(--me);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
  transition: transform .1s, opacity .15s;
}
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .55; }
.btn-primary.danger { background: var(--partner); }
.btn-primary.wide { width: 100%; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-btn);
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 14px;
}
.btn-mini {
  font-size: 13px;
  color: var(--me);
  background: var(--me-soft);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-weight: 600;
}
.link-btn { font-size: 12px; color: var(--muted); padding: 6px; }
.card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: var(--space-card);
  box-shadow: var(--shadow-card);
}
.icon-x {
  width: 26px; height: 26px; flex: none;
  border-radius: 50%;
  color: var(--muted);
  font-size: 18px; line-height: 26px;
  text-align: center;
}
.icon-x:active { background: var(--chip-bg); }

/* ============ 主界面骨架 ============ */
.main { max-width: 480px; margin: 0 auto; min-height: 100dvh; }
.view {
  padding: calc(20px + var(--safe-top)) var(--space-page) calc(var(--nav-h) + var(--safe-bottom) + 36px);
  min-height: 100dvh;
}
.page { animation: page-in .16s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 底部导航 */
.tabbar {
  position: fixed;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: var(--tabbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  z-index: 40;
}
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted);
  padding-top: 4px;
  transition: color .15s;
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab span { font-size: 11px; letter-spacing: .06em; }
.tab.active { color: var(--me); }
.tab.active:nth-child(2) { color: var(--me); }

/* 悬浮按钮 */
.fab {
  position: fixed;
  right: max(20px, calc((100vw - 480px) / 2 + 20px));
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 18px);
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--me);
  color: #fff;
  font-size: 28px; font-weight: 300; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-float);
  z-index: 45;
  transition: transform .12s, opacity .15s;
}
.fab:active { transform: scale(.94); }
.fab:disabled { opacity: .5; }

/* ============ 首页 ============ */
/* 悬浮按钮会盖住页面最后一点内容，给首页/积蓄页留出让位的空白 */
.page-home, .page-money { padding-bottom: 56px; }
.search-box {
  display: flex; align-items: center; gap: 9px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 0 14px;
  height: 48px;
  box-shadow: var(--shadow-card);
}
.search-box:focus-within { border-color: var(--me); box-shadow: 0 0 0 3px rgba(107, 163, 131, .1); }
.search-box svg { width: 19px; height: 19px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.search-box input {
  flex: 1; min-width: 0;
  border: 0; outline: none; background: transparent;
  font-size: 14px;
}
.search-box input::placeholder { color: var(--placeholder); }
.search-results {
  margin-top: 10px;
  background: var(--card);
  border-radius: 18px;
  padding: 4px 16px;
  box-shadow: var(--shadow-card);
}
.sr-item { padding: 11px 0; border-bottom: 1px dashed var(--line); }
.sr-item:last-child { border-bottom: 0; }
.sr-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.src {
  font-size: 10px; font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: .04em;
}
.src-chat { background: var(--me-soft); color: var(--me); }
.src-note { background: var(--accent-soft); color: var(--src-note-ink); }
.src-photo { background: var(--src-photo-bg); color: var(--src-photo-ink); }
.src-ledger { background: var(--partner-soft); color: var(--src-ledger-ink); }
.src-profile { background: var(--src-profile-bg); color: var(--src-profile-ink); }
.src-other { background: var(--chip-bg); color: var(--muted); }
.sr-date { font-size: 11px; color: var(--muted); }
.sr-author { font-size: 11px; color: var(--muted); }
.sr-body { font-size: 13.5px; line-height: 1.6; overflow-wrap: anywhere; }

.sec { margin-top: 24px; }
.sec-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}
.sec-head h2 {
  font-family: var(--font-title);
  font-size: 16px; font-weight: 600; letter-spacing: .06em;
}
.sec-meta { font-size: 11px; color: var(--muted); }
.sec-title { font-family: var(--font-title); font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.empty { color: var(--muted); font-size: 12.5px; padding: 10px 2px; }
.empty.tiny { font-size: 12px; }
.empty-box {
  text-align: center;
  padding: 30px 18px;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  color: var(--muted);
  font-size: 13px;
}
.empty-emoji { font-size: 26px; margin-bottom: 8px; }
.state-box {
  text-align: center;
  padding: 46px 20px;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  color: var(--muted);
  font-size: 13.5px;
}
.state-box p { margin-bottom: 16px; }
.state-emoji { font-size: 30px; margin-bottom: 10px; }
.hint-line {
  font-size: 12px;
  color: var(--muted);
  background: var(--accent-soft);
  border-radius: 14px;
  padding: 10px 14px;
  margin: 12px 0 0;
  line-height: 1.6;
}

/* 照片墙 */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ph {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-photo);
  overflow: hidden;
  background: var(--chip-bg);
}
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph-broken {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 11px; text-align: center;
  border: 1px dashed var(--line);
  background: transparent;
}
.empty-photo {
  border: 1.5px dashed var(--empty-dash);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, .5);
  min-height: 120px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px;
  letter-spacing: .04em;
}

/* 留言 */
.note-list { display: flex; flex-direction: column; gap: 10px; }
.note {
  background: var(--card);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}
.note-head { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-title); font-size: 17px;
  border: 2.5px solid var(--card);
  flex: none;
}
.avatar.xs { width: 24px; height: 24px; font-size: 11px; border-width: 0; }
.note-who { font-size: 12.5px; font-weight: 600; color: var(--text); }
.note-time { font-size: 11px; color: var(--muted); flex: 1; }
.note-body { font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
.note-form {
  display: flex; gap: 10px;
  margin-top: 12px;
}
.note-form .input { flex: 1; background: var(--card); }
.btn-send { flex: none; padding: 0 20px; }

/* 快到了 */
.bar-upcoming {
  display: flex; align-items: center; gap: 10px;
  background: var(--accent-soft);
  border-radius: 16px;
  padding: 13px 16px;
  margin-bottom: 8px;
  color: var(--upcoming-ink);
}
.bar-upcoming.today { background: var(--accent); color: #fff; }
.up-name { font-size: 13.5px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-days { font-size: 13px; font-weight: 700; flex: none; }
.up-date { font-size: 11px; opacity: .8; flex: none; }

/* ============ 今天 ============ */
.day-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.day-block {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px 16px 18px;
  text-align: center;
}
.day-label { font-size: 12px; color: var(--muted); letter-spacing: .2em; margin-left: .2em; }
.day-num {
  font-family: var(--font-num);
  font-size: 44px; font-weight: 700; line-height: 1.1;
  margin: 8px 0 6px;
  letter-spacing: -.02em;
}
.day-num span { font-size: 13px; font-weight: 500; margin-left: 3px; color: var(--muted); letter-spacing: 0; }
.day-num.me { color: var(--me); }
.day-num.partner { color: var(--partner); }
.day-sub { font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.cd-list { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 2px 18px; }
.cd-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px 2px;
  border-bottom: 1px solid var(--line);
}
.cd-row:last-child { border-bottom: 0; }
.cd-info { min-width: 0; }
.cd-name { font-size: 14.5px; font-weight: 500; }
.cd-note { font-size: 11px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.cd-right { text-align: right; flex: none; }
.cd-num {
  font-family: var(--font-num);
  font-size: 27px; font-weight: 700; line-height: 1.15;
  color: var(--text);
}
.cd-num span { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.cd-num.hot { color: var(--accent); }
.cd-num.warm { color: var(--partner); }
.cd-num.today { font-size: 17px; color: var(--accent); }
.cd-date { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

/* ============ 我们 ============ */
.us-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
  position: relative;
}
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -13px; }
.us-title { font-size: 12px; color: var(--muted); flex: 1; line-height: 1.6; }
.seg {
  display: flex;
  background: var(--seg-bg);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 4px;
}
.seg-btn {
  flex: 1;
  border-radius: var(--radius-pill);
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--muted);
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg-btn.active { background: var(--card); color: var(--text); box-shadow: 0 2px 8px rgba(58, 51, 48, .08); font-weight: 600; }
.person-switch { margin-bottom: 16px; }
.profile-card { margin-bottom: var(--space-gap); }
.profile-card .sec-head { margin-bottom: 12px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: var(--radius-pill);
  padding: 7px 8px 7px 13px;
  font-size: 13px;
  color: var(--text);
  max-width: 100%;
}
.chip-body { overflow-wrap: anywhere; }
.chip-x {
  width: 20px; height: 20px; flex: none;
  border-radius: 50%;
  color: var(--muted);
  font-size: 15px; line-height: 20px; text-align: center;
}
.chip-add {
  background: transparent;
  border: 1.2px dashed var(--dash);
  color: var(--muted);
  padding: 6px 12px;
  font-size: 12.5px;
}
.private-head {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding-bottom: 0;
}
.private.open .private-head { padding-bottom: 12px; }
.private-hint { font-size: 11.5px; color: var(--muted); }
.blessing {
  text-align: center;
  font-family: var(--font-title);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .06em;
  padding: 22px 10px 8px;
  line-height: 1.9;
}

/* ============ 积蓄 ============ */
.balance-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #FFFFFF 0%, #FFF9F1 58%, #FDF2E4 100%);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 24px var(--space-card) 22px;
}
.balance-heart {
  position: absolute; right: 14px; top: 2px;
  font-size: 72px; line-height: 1;
  color: var(--partner);
  opacity: .13;
  pointer-events: none;
}
.balance-label { font-size: 12px; color: var(--muted); letter-spacing: .18em; margin-left: .18em; }
.balance-num {
  font-family: var(--font-num);
  font-size: clamp(30px, 9.5vw, 40px);
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 10px 0 8px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.balance-sub { font-size: 12px; color: var(--muted); }
.pos { color: var(--me); }
.neg { color: var(--partner); }
.goal-card { margin-top: var(--space-gap); }
.goal-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13px; }
.goal-target { font-size: 11.5px; color: var(--muted); flex: none; }
.goal-track {
  height: 9px;
  background: var(--track-bg);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin: 12px 0 8px;
}
.goal-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--me), var(--accent));
  transition: width .3s ease;
}
.goal-sub { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.ledger-list { list-style: none; margin: 0; padding: 4px 16px; }
.ledger-row {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.ledger-row:last-child { border-bottom: 0; }
.ledger-row.pending { opacity: .78; }
.ledger-icon {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  background: var(--field-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.ledger-info { flex: 1; min-width: 0; }
.ledger-note { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.pending-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--pending-ink);
  font-size: 10px;
}
.ledger-amt {
  font-family: var(--font-num);
  font-size: 14px; font-weight: 600;
  flex: none;
  letter-spacing: -.01em;
}
.ledger-btn {
  flex: none;
  margin-left: 2px;
  min-width: 26px; height: 26px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 12px;
  line-height: 26px;
  text-align: center;
}
.ledger-btn:active { background: var(--chip-bg); }

/* ============ 照片查看器 ============ */
.viewer {
  position: fixed; inset: 0;
  z-index: 70;
  background: rgba(20, 17, 16, .96);
  background: color-mix(in srgb, var(--viewer-bg) 96%, transparent);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .18s ease;
}
.viewer.show { opacity: 1; }
.viewer-img { max-width: 100vw; max-height: 78vh; object-fit: contain; }
.viewer-missing { color: #D8CCC2; font-size: 13px; }
.viewer-close {
  position: absolute;
  top: calc(14px + var(--safe-top)); left: 16px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 22px; line-height: 1;
}
.viewer-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 16px 20px calc(18px + var(--safe-bottom));
  background: linear-gradient(to top, rgba(20, 17, 16, .9), rgba(20, 17, 16, 0));
  max-width: 480px;
  margin: 0 auto;
}
.viewer-meta { color: var(--viewer-muted); font-size: 12px; }
.viewer-del {
  color: var(--viewer-delete);
  background: rgba(231, 160, 174, .22);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-size: 13px;
}

/* ============ 底部弹层 ============ */
.sheet-wrap { position: fixed; inset: 0; z-index: 75; }
.sheet-mask {
  position: absolute; inset: 0;
  background: var(--mask);
  opacity: 0;
  transition: opacity .18s ease;
}
.sheet-wrap.show .sheet-mask { opacity: 1; }
.sheet {
  position: absolute;
  left: 50%; bottom: 0;
  transform: translate(-50%, 100%);
  width: 100%; max-width: 480px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  padding: 22px var(--space-page) calc(20px + var(--safe-bottom));
  transition: transform .2s ease;
}
.sheet-wrap.show .sheet { transform: translate(-50%, 0); }
.sheet-title {
  font-family: var(--font-title);
  font-size: 17px; font-weight: 600;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
.sheet-text { font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 16px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn-ghost, .sheet-actions .btn-primary { flex: 1; }
.sheet-form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); padding-left: 2px; }
.sheet-form .input { background: var(--field-bg); }
.seg .seg-btn { background: transparent; }
.seg .seg-btn.active { background: var(--card); }

/* ============ Toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 22px);
  transform: translate(-50%, 12px);
  max-width: 84vw;
  background: var(--toast-bg);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 90;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ 骨架屏 ============ */
.sk {
  border-radius: var(--radius-card);
  background: linear-gradient(100deg, var(--sk-base) 30%, var(--sk-shine) 50%, var(--sk-base) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
}
@keyframes shimmer { from { background-position: 180% 0; } to { background-position: -20% 0; } }
.sk-line { height: 46px; margin-bottom: 14px; border-radius: 16px; }
.sk-line.wide { height: 48px; }
.sk-card { height: 130px; margin-bottom: 14px; }

/* ============ 宽屏（电脑预览） ============ */
@media (min-width: 600px) {
  body { background: var(--desktop-bg); }
  .main, .login {
    background: var(--bg);
    box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(58, 51, 48, .08);
  }
}

/* ============ 点击反馈 ============ */
a,
button,
[data-action],
.account,
.chip,
.tab,
.seg button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform .12s ease, opacity .12s ease, background-color .12s ease;
}
a:active,
button:active:not(:disabled),
[data-action]:active,
.account:active,
.chip:active,
.tab:active,
.seg button:active {
  transform: scale(.955);
  opacity: .7;
}

/* ============ 黑夜模式 ============ */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121014;
  --card: #1B181E;
  --line: #2A262F;
  --text: #ECE6E2;
  --muted: #9B9089;
  --me: #7ED0A5;
  --partner: #F2A0B5;
  --accent: #FFD27A;
  --me-soft: #1E2A24;
  --partner-soft: #2A1F24;
  --accent-soft: #2A2419;
  --chip-bg: #262229;
  --field-bg: #1E1B21;
  --placeholder: #7A716B;
  --seg-bg: #262229;
  --track-bg: #2A262F;
  --dash: #3A3540;
  --empty-dash: #3A3540;
  --upcoming-ink: #E0B070;
  --pending-ink: #E0B070;
  --src-note-ink: #D0A060;
  --src-photo-bg: #1F2433;
  --src-photo-ink: #9FB4E0;
  --src-ledger-ink: #E0A0B0;
  --src-profile-bg: #262033;
  --src-profile-ink: #B8A0E0;
  --sk-base: #1E1B21;
  --sk-shine: #2A262F;
  --desktop-bg: #0C0A0E;
  --viewer-bg: #000000;
  --viewer-muted: #B9ADA6;
  --viewer-delete: #FFB4B4;
  --mask: rgba(0, 0, 0, .6);
  --tabbar-bg: rgba(18, 16, 20, .94);
  --toast-bg: rgba(40, 36, 44, .96);
  --shadow-card: 0 2px 10px rgba(0, 0, 0, .35), 0 10px 28px rgba(0, 0, 0, .28);
  --shadow-float: 0 10px 24px rgba(0, 0, 0, .5);
}
html[data-theme="dark"] .notice code { background: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .empty-photo { background: rgba(255, 255, 255, .03); }
html[data-theme="dark"] .balance-card {
  background: linear-gradient(135deg, #241F26 0%, #2A2230 58%, #33261F 100%);
}

/* 区块标题右侧的小文字按钮 */
.sec-link {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--me);
  font-size: 12.5px;
  padding: 2px 4px;
  cursor: pointer;
}
.theme-seg { margin-top: 4px; }

/* ============ 今天页交互 ============ */
.day-block { cursor: pointer; transition: transform .12s ease, opacity .12s ease, box-shadow .12s ease; }
.day-block:active { transform: scale(.965); opacity: .82; box-shadow: none; }
.cd-row { cursor: pointer; border-radius: 12px; transition: background-color .15s ease, transform .12s ease; }
.cd-row:active { background: var(--chip-bg); transform: scale(.99); }
.cd-op { flex: none; width: 18px; text-align: center; color: var(--muted); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
