:root {
  --navy: #1B3A4A;
  --navy-light: #243D4D;
  --gold: #C8963E;
  --gold-light: #D4A855;
  --gold-pale: #F5EDE0;
  /* ─── 色值以小程序端为准 ───
     原来 Web 端自成一套（绿 #4A9E6E、橙 #D4953A、红 #C85555、正文 #2C2C2C…），
     小程序和后台是另一套。同一个「成功」状态两端颜色不一样，用户从小程序
     切到 Web 会明显感觉是两个产品。
     小程序是主入口、admin 后台也跟着它，所以统一到小程序这套 ——
     Web 端只改这 8 个变量值，一处生效，不用动小程序那 6 个 wxss。 */
  --bg: #F5F0EB;
  --card: #FFFFFF;
  --text: #2C3E50;
  --text-secondary: #5D6D7E;
  --text-muted: #95A5A6;
  --green: #2E7D32;
  --green-bg: #E8F5E9;
  --orange: #E67E22;
  --orange-bg: #FFF3E0;
  --red: #C0392B;
  --red-bg: #FDECEA;
  --border: #E8E4DF;
  --shadow-sm: 0 1px 3px rgba(27,58,74,0.06);
  --shadow-md: 0 4px 16px rgba(27,58,74,0.08);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 8px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #E8E3DA;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

h1, h2, h3, h4 { font-family: 'Noto Serif SC', serif; }

#app {
  width: 375px;
  height: 812px;
  max-height: 95vh;
  background: var(--bg);
  border-radius: 32px;
  overflow: hidden;
  box-shadow: 0 0 0 6px #1a1a1a, 0 0 0 8px #2a2a2a, 0 0 0 10px #1a1a1a, 0 8px 32px rgba(27,58,74,0.12);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 手机访问：脱掉「手机外壳」，直接全屏。
   固定 375px 宽 + body 左右各 20px 内边距 = 需要 415px 视口，
   iPhone SE(375) 及更窄机型会横向溢出、右侧被裁掉，
   而 viewport 又禁了缩放，用户连缩小看全的机会都没有。
   桌面端保留外壳（那是它的设计意图），只在窄屏还原成全屏。 */
@media (max-width: 480px) {
  body { padding: 0; }
  #app {
    width: 100%;
    height: 100vh;
    height: 100dvh; /* 支持动态视口的浏览器用它，避开移动端地址栏高度问题 */
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }
}

/* Status Bar */
.status-bar {
  height: 44px;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Header */
.app-header {
  background: var(--navy);
  color: white;
  padding: 12px 20px 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header h1 { font-size: 20px; font-weight: 700; letter-spacing: 2px; }
.app-header .back-btn {
  background: none; border: none; color: white; font-size: 20px;
  cursor: pointer; padding: 4px 8px; font-family: inherit;
}

/* Main Content */
.main-content { flex: 1; overflow-y: auto; padding: 16px; scroll-behavior: smooth; }
.main-content::-webkit-scrollbar { width: 0; }

/* Tab Bar */
.tab-bar {
  height: 64px;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: var(--safe-bottom);
  flex-shrink: 0;
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; padding: 6px 12px; border-radius: 8px;
  transition: all 0.2s; border: none; background: none;
  font-family: inherit; font-size: 12px; color: var(--text-muted);
}
.tab-item .tab-icon { font-size: 20px; line-height: 1; transition: transform 0.2s; }
.tab-item.active { color: var(--navy); font-weight: 600; }
.tab-item.active .tab-icon { transform: scale(1.1); }

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text); font-family: 'Noto Serif SC', serif; }

/* Overview Grid */
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  text-align: center; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.2s;
}
.stat-card:active { transform: scale(0.96); }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--navy); font-family: 'Noto Serif SC', serif; line-height: 1; }
.stat-card .stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.stat-card.accent .stat-value { color: var(--gold); }

/* Status Badge */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.badge-dot.green { background: var(--green); }
.badge-dot.orange { background: var(--orange); }
.badge-dot.red { background: var(--red); }

/* Policy Item */
.policy-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.policy-item:last-child { border-bottom: none; }
.policy-icon {
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.policy-info { flex: 1; min-width: 0; }
.policy-info .policy-name { font-size: 14px; font-weight: 600; color: var(--text); }
.policy-info .policy-meta { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }

/* Check-in */
.checkin-section {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  border-radius: var(--radius-lg); padding: 20px; text-align: center;
  color: white; margin-bottom: 16px;
}
.checkin-section .checkin-title { font-size: 14px; opacity: 0.85; margin-bottom: 4px; }
.checkin-section .checkin-countdown { font-size: 13px; opacity: 0.7; margin-bottom: 16px; }
.checkin-btn {
  width: 80px; height: 80px; border-radius: 50%; border: none;
  background: var(--gold); color: white; font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: 'Noto Serif SC', serif; letter-spacing: 1px;
  animation: pulse 2.5s infinite; transition: transform 0.15s;
  box-shadow: 0 4px 20px rgba(200,150,62,0.4);
}
.checkin-btn:active { transform: scale(0.9); }
.checkin-btn.checked { background: var(--green); animation: none; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200,150,62,0.5); }
  50% { box-shadow: 0 0 0 16px rgba(200,150,62,0); }
}

/* Duplicate Analysis */
.dup-card {
  background: linear-gradient(135deg, #FFF8F0, #FFF3E4);
  border: 1px solid var(--orange); border-radius: var(--radius-lg);
  padding: 16px; margin-bottom: 16px; cursor: pointer;
}
.dup-card .dup-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.dup-card .dup-title { font-size: 15px; font-weight: 700; color: var(--orange); font-family: 'Noto Serif SC', serif; }
.dup-save { margin-left: auto; font-size: 13px; color: var(--red); font-weight: 600; }
.dup-group {
  background: white; border-radius: var(--radius-sm); padding: 12px;
  margin-bottom: 8px; border: 1px solid var(--border);
}
.dup-group-header { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.dup-person { background: var(--orange); color: white; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.dup-policy-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.dup-warn { color: var(--red); font-size: 12px; font-weight: 600; margin-left: 6px; }
.dup-verdict {
  background: #FFF0F0; border-radius: var(--radius-sm); padding: 10px 12px;
  margin-top: 8px; font-size: 12px; color: var(--red); display: flex; align-items: center; gap: 6px;
}
.dup-amount { font-weight: 700; font-size: 15px; }
.dup-none {
  background: var(--green-bg); border-radius: var(--radius); padding: 12px 16px;
  text-align: center; font-size: 13px; color: var(--green); margin-bottom: 16px;
}

/* Will Items */
.will-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.will-item:last-child { border-bottom: none; }
.will-icon-box {
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  background: var(--gold-pale); display: flex; align-items: center;
  justify-content: center; font-size: 18px; flex-shrink: 0;
}
.will-info { flex: 1; min-width: 0; }
.will-info .will-title { font-size: 14px; font-weight: 600; color: var(--text); }
.will-info .will-category { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.lock-icon { color: var(--gold); }

/* Filter Tabs */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 4px; }
.filter-tab {
  padding: 6px 14px; border-radius: 20px; font-size: 12px; white-space: nowrap;
  cursor: pointer; border: 1px solid var(--border); background: white;
  color: var(--text-secondary); transition: all 0.2s; font-family: inherit;
}
.filter-tab.active { background: var(--navy); color: white; border-color: var(--navy); }

/* Quick Actions */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.quick-action {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; display: flex;
  align-items: center; gap: 10px; cursor: pointer; transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.quick-action:active { transform: scale(0.96); }
.qa-icon { font-size: 24px; width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.qa-text { font-size: 13px; font-weight: 600; color: var(--text); }
.qa-icon.navy { background: rgba(27,58,74,0.1); }
.qa-icon.gold { background: var(--gold-pale); }

/* Profile */
.profile-header { text-align: center; padding: 20px 0; }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--gold-pale); margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.profile-name { font-size: 18px; font-weight: 700; }
.profile-id { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.subscription-card {
  background: linear-gradient(135deg, var(--navy), #2A5068);
  color: white; border-radius: var(--radius-lg); padding: 16px;
  margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center;
}
.subscription-card h3 { font-size: 15px; margin-bottom: 4px; }
.subscription-card .sub-price { font-size: 28px; font-weight: 700; }
.subscription-card .sub-price span { font-size: 14px; font-weight: 400; opacity: 0.8; }

/* Menu List */
.menu-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; font-size: 14px; color: var(--text);
}
.menu-item:last-child { border-bottom: none; }
.menu-left { display: flex; align-items: center; gap: 10px; }
.menu-icon { font-size: 18px; width: 24px; text-align: center; }
.menu-arrow { color: var(--text-muted); }

/* Member Avatars */
.member-avatars { display: flex; gap: 12px; flex-wrap: wrap; }
.member-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: white; cursor: pointer;
}
.member-avatar.add { background: var(--border); color: var(--text-muted); font-size: 20px; }

/* Checkin History */
.checkin-history { display: flex; gap: 6px; flex-wrap: wrap; }
.checkin-dot { width: 10px; height: 10px; border-radius: 50%; }
.checkin-dot.done { background: var(--green); }
.checkin-dot.miss { background: var(--border); }

/* FAB */
.add-fab { position: sticky; bottom: 0; padding: 10px; text-align: center; background: linear-gradient(transparent, var(--bg) 40%); }
.add-btn {
  width: 48px; height: 48px; border-radius: 50%; background: var(--navy);
  color: white; border: none; font-size: 24px; cursor: pointer;
  box-shadow: var(--shadow-md); transition: all 0.2s;
}
.add-btn:active { transform: scale(0.9); }

/* Modal */
.modal-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; z-index: 100;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-sheet {
  background: white; border-radius: 20px 20px 0 0; width: 100%;
  max-height: 85%; overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 32px; height: 4px; background: #ddd; border-radius: 2px; margin: 10px auto 0; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: white;
}
.modal-header h2 { font-size: 17px; font-weight: 600; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%; background: #f0f0f0;
  border: none; font-size: 18px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; color: var(--text-secondary);
}
.modal-body { padding: 16px 20px 30px; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; display: block; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text);
  background: var(--bg); transition: border 0.2s; font-family: inherit; outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--gold); background: white; }
.form-textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Buttons */
.btn {
  padding: 12px 24px; border-radius: var(--radius); font-size: 15px;
  font-weight: 600; cursor: pointer; border: none; transition: all 0.2s;
  font-family: inherit; width: 100%;
}
.btn-primary { background: var(--navy); color: white; }
.btn-primary:active { background: var(--navy-light); transform: scale(0.98); }
.btn-gold { background: var(--gold); color: white; }
.btn-gold:active { background: var(--gold-light); transform: scale(0.98); }
.btn-outline { background: white; color: var(--navy); border: 1px solid var(--navy); }
.btn-small { padding: 6px 14px; font-size: 12px; width: auto; border-radius: 20px; }

/* Detail */
.detail-section { margin-bottom: 16px; }
.detail-section h3 { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; letter-spacing: 1px; }
.detail-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.detail-row:last-child { border-bottom: none; }

/* 缴费频率的年化提示。15px 加粗：这是用户判断「填的是月缴还是年缴」的唯一依据，
   目标用户里有大量中老年人，做成 12px 灰色小字等于没有提示。 */
.premium-hint { font-size: 15px; font-weight: 700; color: var(--navy); margin-top: 8px; min-height: 18px; }
.detail-hint { font-size: 12px; color: var(--text-muted); padding: 4px 0 6px 0; }

/* Toast */
.toast {
  position: absolute; top: 60px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: white; padding: 10px 24px;
  border-radius: 24px; font-size: 13px; z-index: 200;
  animation: toastIn 0.3s, toastOut 0.3s 1.5s forwards; white-space: nowrap;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* Empty State */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.6; }

/* Section Title */
.section-title { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }

/* Login */
.login-page { text-align: center; padding: 60px 20px; }
.login-page .login-logo { font-size: 64px; margin-bottom: 16px; }
.login-page .login-title { font-size: 24px; font-weight: 700; font-family: 'Noto Serif SC', serif; margin-bottom: 8px; }
.login-page .login-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 40px; }
