/* ============================================
   减脂助手 · Anker & Cinly Edition
   配色：紫色主色 + 金色辅色
   移动端优先设计
   ============================================ */

:root {
  /* ——— 主色：深紫 ——— */
  --primary:       #7C3AED;   /* violet-600 */
  --primary-dark:  #5B21B6;   /* violet-800 */
  --primary-light: #F5F0FF;   /* violet-50  */
  --primary-mid:   #DDD6FE;   /* violet-200 */

  /* ——— 辅色：金色 ——— */
  --gold:          #D4A017;
  --gold-dark:     #A97C10;
  --gold-light:    #FDF8E7;
  --gold-mid:      #F7E08A;

  /* ——— 功能色（保留语义，调整为与紫金协调）——— */
  --secondary:       #6D28D9;  /* 紫色次深 */
  --secondary-light: #EDE9FE;

  --blue:       #4F46E5;   /* indigo */
  --blue-light: #EEF2FF;

  --green:       #059669;  /* emerald */
  --green-light: #D1FAE5;

  --red:       #DC2626;
  --red-light: #FEE2E2;

  --orange:       #D97706;
  --orange-light: #FEF3C7;

  --yellow:       #B45309;
  --yellow-light: #FEF9C3;

  /* ——— 背景/界面 ——— */
  --bg:           #F8F6FF;   /* 淡紫底色 */
  --surface:      #FFFFFF;
  --border:       #E5E0F5;   /* 带紫调的分割线 */
  --text-primary: #1E1235;   /* 深紫黑 */
  --text-secondary:#6B6B8A;
  --text-muted:   #A89FC5;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 4px rgba(124,58,237,0.07);
  --shadow:    0 4px 16px rgba(124,58,237,0.10);
  --shadow-lg: 0 8px 32px rgba(124,58,237,0.15);

  --transition: 0.2s ease;
  --header-h: 64px;
  --nav-h: 64px;
}

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

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  padding-bottom: 80px;
}

/* ============ HEADER ============ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, #4C1D95 0%, #7C3AED 55%, #9F67FA 100%);
  height: var(--header-h);
  box-shadow: 0 2px 16px rgba(91,33,182,0.4);
}

.header-inner {
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.logo-main {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.logo-couple {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--gold-mid);
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.logo-heart {
  font-size: 0.6rem;
  color: #FFB3C6;
  animation: heartbeat 1.4s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14%       { transform: scale(1.3); }
  28%       { transform: scale(1); }
  42%       { transform: scale(1.2); }
  70%       { transform: scale(1); }
}

.logo-icon {
  font-size: 1.3rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.header-subtitle {
  color: rgba(255,255,255,0.85);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

/* Header right: user badge + switch btn */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.current-user-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 4px 10px 4px 6px;
  cursor: default;
}

.cub-avatar {
  font-size: 1.05rem;
  line-height: 1;
}

.cub-name {
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.switch-user-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.switch-user-btn:hover {
  background: rgba(255,255,255,0.28);
  transform: rotate(180deg);
}

/* ============ TAB NAV ============ */
.tab-nav {
  position: sticky;
  top: var(--header-h);
  z-index: 99;
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* Make nav full width on mobile */
@media (max-width: 480px) {
  .tab-nav { max-width: 100%; }
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
  font-family: inherit;
}

.tab-btn i { font-size: 1.1rem; }

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--primary-light);
}

.tab-btn:active { transform: scale(0.95); }

/* ============ MAIN ============ */
.app-main {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 12px;
}

/* ============ TAB PANELS ============ */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-header { margin-bottom: 16px; }

.panel-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-header h2 i { color: var(--primary); }

.panel-desc {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ============ CARD ============ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-title i { color: var(--primary); font-size: 0.9rem; }

.card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* ============ FORM ============ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.unit {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
  background: var(--surface);
}

.hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Gender selector */
.gender-selector {
  display: flex;
  gap: 8px;
}

.gender-btn {
  flex: 1;
  padding: 10px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.gender-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

/* Info box */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--blue-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.78rem;
  color: var(--blue);
  line-height: 1.5;
  margin-top: 10px;
}

.info-box i { flex-shrink: 0; margin-top: 1px; }

/* Badge */
.badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-optional { background: var(--yellow-light); color: var(--yellow); }
.badge-count {
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  min-width: 20px;
  text-align: center;
}

/* Activity list */
.activity-list { display: flex; flex-direction: column; gap: 8px; }

.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.activity-item:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.activity-item input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; }

.activity-title { font-size: 0.85rem; font-weight: 600; }
.activity-desc { font-size: 0.75rem; color: var(--text-secondary); margin-top: 1px; }

/* ============ BUTTONS ============ */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary) 60%, #9F67FA);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(124,58,237,0.38);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,58,237,0.48); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-secondary:hover { background: var(--primary); color: #fff; }

.btn-full { width: 100%; }

.mt-2 { margin-top: 12px; }

/* ============ BMR RESULT ============ */
.result-card {
  background: linear-gradient(160deg, #FDFAFF 0%, var(--surface) 100%);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  margin-top: 16px;
  border: 2px solid var(--primary);
  box-shadow: 0 4px 20px rgba(124,58,237,0.14);
}

.formula-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-box {
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
}

.metric-blue { background: var(--blue-light); }
.metric-orange { background: var(--orange-light); }
.metric-green { background: var(--green-light); }
.metric-gold   { background: var(--gold-light); }
.metric-purple { background: var(--primary-light); }

.metric-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.metric-blue .metric-value { color: var(--blue); }
.metric-orange .metric-value { color: var(--orange); }
.metric-green .metric-value { color: var(--green); }
.metric-gold .metric-value   { color: var(--gold-dark); }
.metric-purple .metric-value { color: var(--primary); }

.metric-unit {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============ TOGGLE BAR ============ */
.toggle-bar {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.toggle-btn {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
}

.toggle-btn.active {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}

/* ============ FOOD GRID ============ */
.food-category-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.food-category-tabs::-webkit-scrollbar { display: none; }

.cat-btn {
  flex-shrink: 0;
  padding: 5px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.cat-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.food-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.food-item {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.food-item:active { transform: scale(0.95); }

.food-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.food-emoji { font-size: 1.4rem; line-height: 1; margin-bottom: 3px; }
.food-name { font-size: 0.72rem; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.food-cal { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }

/* Selected foods list */
.selected-food-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.selected-food-row:last-child { border-bottom: none; }

.sfd-emoji { font-size: 1.2rem; flex-shrink: 0; }

.sfd-info { flex: 1; min-width: 0; }
.sfd-name { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sfd-cal { font-size: 0.72rem; color: var(--text-secondary); }

.sfd-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  width: 26px; height: 26px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  transition: all var(--transition);
  flex-shrink: 0;
}

.qty-btn:active { transform: scale(0.9); background: var(--primary-light); }

.qty-val {
  min-width: 20px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.sfd-remove {
  color: var(--red);
  background: none;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  transition: transform var(--transition);
}

.sfd-remove:active { transform: scale(0.8); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 0;
  color: var(--text-muted);
}

.empty-state i { font-size: 2rem; }
.empty-state p { font-size: 0.82rem; }

.total-calories {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 2px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
}

.total-val {
  font-size: 1.1rem;
  color: var(--primary);
  font-weight: 700;
}

/* Quick exercise buttons */
.exercise-quick-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.quick-label {
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.quick-btn {
  flex: 1 1 calc(33.33% - 8px);
  min-width: 80px;
  padding: 7px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  text-align: center;
  line-height: 1.4;
}

.quick-btn:active { background: var(--gold-light); border-color: var(--gold); color: var(--gold-dark); }
.quick-btn.selected { background: var(--gold-light); border-color: var(--gold); color: var(--gold-dark); }

/* ============ RESULT SUMMARY ============ */
.result-summary-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.summary-card {
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

/* 摄入卡：紫色 */
.card-red   { background: linear-gradient(135deg, #7C3AED, #5B21B6); color: #fff; }
/* 消耗卡：靛蓝 */
.card-blue  { background: linear-gradient(135deg, #4F46E5, #3730A3); color: #fff; }
/* 缺口卡：祖母绿 */
.card-green { background: linear-gradient(135deg, #059669, #047857); color: #fff; }
/* 盈余卡：金色 */
.card-orange{ background: linear-gradient(135deg, #D4A017, #A97C10); color: #fff; }

.summary-icon { font-size: 1.6rem; flex-shrink: 0; opacity: 0.9; }

.summary-label { font-size: 0.72rem; font-weight: 500; opacity: 0.85; }
.summary-val { font-size: 1.8rem; font-weight: 700; line-height: 1; margin: 2px 0; }
.summary-unit { font-size: 0.7rem; opacity: 0.8; }

/* ============ CHART ============ */
.chart-container {
  position: relative;
  width: 100%;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============ MACRO BARS ============ */
.macro-bars { display: flex; flex-direction: column; gap: 12px; }

.macro-row { }

.macro-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.macro-name { font-size: 0.8rem; font-weight: 600; }
.macro-val { font-size: 0.78rem; color: var(--text-secondary); }

.macro-bar-track {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.macro-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.bar-protein { background: var(--blue); }
.bar-fat { background: var(--orange); }
.bar-carb { background: var(--green); }

/* ============ GAP ASSESS ============ */
.gap-assess {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assess-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.assess-icon { font-size: 1.3rem; flex-shrink: 0; }
.assess-text { line-height: 1.4; }
.assess-label { font-weight: 600; display: block; }
.assess-desc { color: var(--text-secondary); font-size: 0.75rem; }

.assess-danger { background: var(--red-light); color: var(--red); }
.assess-warning { background: var(--yellow-light); color: #92640A; }
.assess-ok { background: var(--green-light); color: #076D50; }
.assess-surplus { background: var(--orange-light); color: var(--orange); }

/* ============ PREDICT ============ */
.predict-milestones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.milestone-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
}

.milestone-card.highlight {
  border-color: var(--primary);
  background: var(--primary-light);
}

.milestone-label { font-size: 0.72rem; color: var(--text-secondary); font-weight: 500; }
.milestone-val { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); margin: 4px 0; }
.milestone-val.text-primary { color: var(--primary); }
.milestone-val.text-blue { color: var(--blue); }
.milestone-val.text-green { color: var(--green); }
.milestone-val.text-secondary-color { color: var(--secondary); }
.milestone-sub { font-size: 0.7rem; color: var(--text-muted); }

/* Milestone table */
.milestone-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.milestone-table th {
  background: var(--bg);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1.5px solid var(--border);
}

.milestone-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.milestone-table tr:last-child td { border-bottom: none; }

.milestone-table tr:nth-child(even) td { background: var(--bg); }

td.highlight-cell { color: var(--gold-dark); font-weight: 700; }

/* Warning card */
.warning-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--yellow-light);
  border: 1.5px solid var(--yellow);
}

.warning-card i { color: var(--yellow); font-size: 1.3rem; flex-shrink: 0; margin-top: 2px; }
.warning-card strong { font-size: 0.88rem; display: block; margin-bottom: 4px; }
.warning-card p { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.5; }

/* ============ FOOTER ============ */
.app-footer {
  text-align: center;
  padding: 20px 16px;
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.8;
  background: linear-gradient(to bottom, var(--surface), #F5F0FF);
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.footer-couple {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
}

.footer-heart {
  color: #F87BAC;
  animation: heartbeat 1.4s ease-in-out infinite;
  font-size: 0.8rem;
}

/* ============ UTILITY ============ */
.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ============ DESKTOP ADAPTATION ============ */
@media (min-width: 520px) {
  body {
    background: linear-gradient(135deg, #F0EBFF 0%, #F8F6FF 50%, #EEF2FF 100%);
  }

  .app-header {
    /* Full-width header on desktop */
  }

  .tab-nav {
    max-width: 520px;
    margin: 0 auto;
    border-radius: 0 0 var(--radius) var(--radius);
  }

  .app-main {
    max-width: 520px;
    margin: 0 auto;
    padding: 20px 16px;
  }

  .metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .predict-milestones {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Smooth transitions for tab switching */
.tab-panel {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ LOADING ============ */
.spin {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Number input arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.6;
}

/* ============================================================
   V1.1 新增样式
   ============================================================ */

/* ---- 食物网格：数量控件 ---- */
.food-qty-ctrl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 5px;
}

.fq-btn {
  width: 22px; height: 22px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
  line-height: 1;
}

.fq-btn:active { transform: scale(0.85); }

.fq-inc { border-color: var(--primary); color: var(--primary); }
.fq-inc:active { background: var(--primary); color: #fff; }

.fq-dec { border-color: var(--border); color: var(--text-muted); }
.fq-dec:active { background: var(--red-light); border-color: var(--red); color: var(--red); }

.fq-val {
  min-width: 22px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
}

/* 食物已选中时放大显示数量 */
.food-item.selected .fq-val {
  font-size: 0.9rem;
}

/* 清单行：数量输入框 */
.qty-input {
  width: 44px;
  text-align: center;
  padding: 4px 2px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--bg);
  color: var(--text-primary);
}

.qty-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}

/* ---- 今日数据恢复 Banner ---- */
.today-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--primary);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.today-banner i { flex-shrink: 0; }

.today-banner button {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all var(--transition);
}

.today-banner button:active { opacity: 0.85; }

/* ---- 历史记录 ---- */
.hist-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.hist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.hist-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.hist-gap-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.hist-ok      { background: var(--green-light);  color: #076D50; }
.hist-surplus { background: var(--orange-light);  color: var(--orange); }
.hist-danger  { background: var(--red-light);     color: var(--red); }

.hist-metrics {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.hist-metric {
  flex: 1;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
}

.hm-label { display: block; font-size: 0.65rem; color: var(--text-muted); font-weight: 500; }
.hm-val   { display: block; font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.hm-u     { display: block; font-size: 0.62rem; color: var(--text-muted); }

.hist-foods {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.hist-food-tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ---- 体重打卡 ---- */
.wl-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.wl-stat {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}

.wls-label { display: block; font-size: 0.68rem; color: var(--text-muted); font-weight: 500; }
.wls-val   { display: block; font-size: 1.05rem; font-weight: 700; color: var(--text-primary); margin: 2px 0; }
.wls-date  { display: block; font-size: 0.62rem; color: var(--text-muted); }

.text-green  { color: var(--green) !important; }
.text-orange { color: var(--orange) !important; }

.wl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.wl-row:last-child { border-bottom: none; }

.wl-date   { font-size: 0.8rem; color: var(--text-secondary); flex-shrink: 0; }
.wl-weight { font-size: 1rem; font-weight: 700; color: var(--text-primary); flex: 1; }

.wl-delta {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  flex-shrink: 0;
}

.wl-down { background: var(--green-light); color: #076D50; }
.wl-up   { background: var(--red-light);   color: var(--red); }

.wl-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.8rem;
  transition: color var(--transition);
  flex-shrink: 0;
}

.wl-del:hover { color: var(--red); }

/* Tab nav 6 tabs — 字体更小 */
.tab-btn span { font-size: 0.62rem; }
.tab-btn i    { font-size: 1rem; }

/* Food grid 增大行高（容纳数量控件） */
.food-item {
  padding-bottom: 6px;
}

/* 今日恢复 banner — 置于 app-main 顶部 */
.app-main > .today-banner {
  display: flex;
}

/* ============================================================
   V1.2 新增样式：BMR 结果参数摘要 / 用户启动遮罩 / 体重更新提示 / Toast
   ============================================================ */

/* ---- BMR 结果内参数摘要行 ---- */
.result-params {
  background: var(--primary-light);
  border: 1px solid var(--primary-mid);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
}

.rp-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}

.rp-item {
  display: flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}

.rp-icon {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 700;
  margin-right: 1px;
}

.rp-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.rp-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.rp-unit {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-left: 1px;
}

/* ---- 预设用户简化表单体重输入放大 ---- */
.weight-input-large {
  font-size: 1.4rem !important;
  font-weight: 700 !important;
  text-align: center;
  color: var(--primary-dark) !important;
  letter-spacing: 0.04em;
}

/* ---- 启动遮罩 ---- */
.user-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(150deg, #4C1D95 0%, #7C3AED 50%, #A855F7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.user-splash.splash-exit {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

.user-splash.hidden {
  display: none;
}

.splash-inner {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.splash-logo {
  margin-bottom: 36px;
}

.splash-icon {
  font-size: 3rem;
  color: var(--gold-mid);
  filter: drop-shadow(0 4px 12px rgba(212,160,23,0.5));
  display: block;
  margin-bottom: 10px;
  animation: heartbeat 1.4s ease-in-out infinite;
}

.splash-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.04em;
}

.splash-couple {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold-mid);
  margin: 4px 0 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.splash-heart {
  color: #FFB3C6;
  animation: heartbeat 1.4s ease-in-out infinite;
}

.splash-subtitle {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.06em;
}

.splash-question {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
  opacity: 0.9;
}

.splash-users {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 20px;
}

.splash-user-btn {
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  flex: 1;
  max-width: 140px;
}

.splash-user-btn:hover,
.splash-user-btn:active {
  background: rgba(255,255,255,0.22);
  border-color: var(--gold-mid);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.splash-avatar {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 8px;
}

.splash-name {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
}

.splash-info {
  color: rgba(255,255,255,0.65);
  font-size: 0.72rem;
  margin-top: 3px;
}

.splash-heart-divider {
  color: #FFB3C6;
  font-size: 1.2rem;
  padding: 0 16px;
  animation: heartbeat 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

.splash-new-user {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 24px;
  color: rgba(255,255,255,0.8);
  padding: 10px 20px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.splash-new-user:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.6);
}

/* 新用户表单 */
.splash-new-form {
  margin-top: 16px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
}

.snf-field {
  margin-bottom: 12px;
}

.snf-field label {
  display: block;
  color: rgba(255,255,255,0.85);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.snf-field input {
  width: 100%;
  padding: 9px 12px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.snf-field input::placeholder { color: rgba(255,255,255,0.45); }
.snf-field input:focus { border-color: var(--gold-mid); }

.snf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.snf-gender {
  display: flex;
  gap: 8px;
}

.snf-gbtn {
  flex: 1;
  padding: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.75);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

.snf-gbtn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

.splash-confirm-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

.splash-confirm-btn:hover { filter: brightness(1.1); }
.splash-confirm-btn:active { transform: scale(0.98); }

/* ---- 体重更新提示 ---- */
.weight-update-prompt {
  background: linear-gradient(135deg, #F5F0FF, #EDE9FE);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 12px 0 4px;
  box-shadow: var(--shadow);
}

.wup-inner { }

.wup-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.wup-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.wup-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.wup-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.wup-opt {
  font-size: 0.65rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 4px;
}

.wup-field input {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  background: var(--surface);
  transition: border-color var(--transition);
}

.wup-field input:focus { border-color: var(--primary); }

.wup-actions {
  display: flex;
  gap: 10px;
}

.wup-skip {
  flex: 1;
  padding: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

.wup-skip:hover { border-color: var(--text-secondary); }

.wup-confirm {
  flex: 2;
  padding: 10px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition);
}

.wup-confirm:active { transform: scale(0.98); }

/* ---- Toast 通知 ---- */
.toast-msg {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-dark);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(91,33,182,0.4);
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* 只读输入框样式 */
input[readonly] {
  background: var(--primary-light) !important;
  color: var(--text-secondary) !important;
  cursor: not-allowed;
  border-color: var(--primary-mid) !important;
}

/* ============================================================
   V2.0 新增样式
   ============================================================ */

/* ---- 食物搜索栏 ---- */
.food-search-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 0 14px;
  margin: 0 0 12px;
  gap: 8px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.food-search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}
.food-search-icon { color: var(--text-muted); font-size: 0.85rem; }
.food-search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 11px 0;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-primary);
}
.food-search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
  transition: color var(--transition);
}
.food-search-clear:hover { color: var(--red); }

/* ---- 常用组合 ---- */
.combos-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.combo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.combo-header i { color: var(--primary); margin-right: 4px; }
.combo-add-btn {
  background: var(--primary-light);
  border: 1px solid var(--primary-mid);
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.combo-add-btn:hover { background: var(--primary); color: #fff; }
.combos-empty { font-size: 0.75rem; color: var(--text-muted); text-align: center; padding: 4px 0; }
.combos-list { display: flex; flex-direction: column; gap: 6px; }
.combo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.combo-emoji { font-size: 1.3rem; flex-shrink: 0; }
.combo-info { flex: 1; min-width: 0; }
.combo-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); display: block; }
.combo-cal  { font-size: 0.72rem; color: var(--text-muted); }
.combo-use-btn {
  background: var(--primary);
  border: none;
  border-radius: 12px;
  color: #fff;
  padding: 4px 10px;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: filter var(--transition);
}
.combo-use-btn:hover { filter: brightness(1.1); }
.combo-del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px;
  transition: color var(--transition);
}
.combo-del-btn:hover { color: var(--red); }

/* ---- 食物网格空态 ---- */
.food-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.food-grid-empty i { font-size: 1.8rem; display: block; margin-bottom: 8px; }
.custom-food-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.custom-food-empty i { font-size: 2rem; display: block; margin-bottom: 8px; color: var(--primary-mid); }

/* ---- 自定义食物 FAB ---- */
.add-custom-food-fab {
  position: sticky;
  bottom: 80px;
  left: 100%;
  transform: translateX(-60px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 50;
  margin-top: -22px;
  margin-bottom: 10px;
}
.add-custom-food-fab:hover { transform: translateX(-60px) scale(1.1); box-shadow: 0 6px 24px rgba(124,58,237,0.4); }

/* ---- 弹窗 Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 8000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; color: var(--primary-dark); }
.modal-close {
  background: var(--bg);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: background var(--transition);
}
.modal-close:hover { background: var(--red-light); color: var(--red); }
.modal-body { padding: 14px 18px; }
.modal-footer {
  display: flex;
  gap: 10px;
  padding: 12px 18px 20px;
  border-top: 1px solid var(--border);
}
.modal-footer .btn-secondary { flex: 1; }
.modal-footer .btn-primary   { flex: 2; }

/* ---- 情侣共享看板 ---- */
.couple-panel-header h2 { color: var(--primary-dark); }
.couple-panel-header h2 i { color: #E11D48; }

.couple-today-cards {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 10px;
}
.couple-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  padding: 0 6px;
  flex-shrink: 0;
  animation: heartbeat 1.4s ease-in-out infinite;
}
.couple-card {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 12px;
  border: 2px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.couple-card-anker { border-color: rgba(124,58,237,0.3); }
.couple-card-cinly { border-color: rgba(225,29,72,0.25); }
.cc-avatar { font-size: 1.8rem; text-align: center; margin-bottom: 3px; }
.cc-name {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}
.cc-stats { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.cc-stat {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-size: 0.72rem;
}
.cc-label { color: var(--text-muted); flex: 1; }
.cc-val { font-weight: 700; color: var(--text-primary); font-size: 0.9rem; }
.cc-unit { color: var(--text-muted); font-size: 0.62rem; }
.cc-gap .cc-val { font-size: 1rem; }
.cc-bar-wrap {
  height: 5px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.cc-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}
.cc-no-data {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 4px 0;
}

/* 今日赢家横幅 */
.winner-banner {
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 10px;
}
.winner-a    { background: var(--primary-light); color: var(--primary-dark); border: 1.5px solid var(--primary-mid); }
.winner-c    { background: #FEE2E2; color: #991B1B; border: 1.5px solid #FECACA; }
.winner-tie  { background: var(--gold-light); color: var(--gold-dark); border: 1.5px solid var(--gold-mid); }

/* 共同目标 */
.goal-set-prompt { font-size: 0.85rem; color: var(--text-secondary); }
.goal-set-prompt button { background: none; border: none; color: var(--primary); cursor: pointer; font-weight: 600; text-decoration: underline; font-family: inherit; font-size: inherit; }
.goal-card { padding: 4px 0; }
.goal-title { font-size: 1rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 4px; }
.goal-sub { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 10px; }
.goal-progress-wrap { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.goal-progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary-dark), var(--primary)); border-radius: 4px; transition: width 0.8s ease; }
.goal-progress-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 8px; }
.goal-detail-row { display: flex; gap: 16px; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.btn-icon { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 0.8rem; padding: 2px 6px; }

/* 互相留言 */
.messages-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px 0;
}
.msg-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.msg-self { flex-direction: row-reverse; }
.msg-avatar { font-size: 1.3rem; flex-shrink: 0; margin-top: 2px; }
.msg-bubble {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  max-width: 78%;
}
.msg-self .msg-bubble { background: var(--primary-light); }
.msg-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.msg-name { font-size: 0.7rem; font-weight: 700; color: var(--primary); }
.msg-time { font-size: 0.62rem; color: var(--text-muted); }
.msg-text { font-size: 0.85rem; color: var(--text-primary); line-height: 1.4; }
.message-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.message-input-row input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.message-input-row input:focus { border-color: var(--primary); }
.message-input-row .btn-primary {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 成就系统 */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.achievement-item {
  text-align: center;
  padding: 14px 8px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--bg);
  transition: all var(--transition);
}
.achievement-item.unlocked {
  border-color: var(--gold);
  background: var(--gold-light);
  box-shadow: 0 2px 8px rgba(212,160,23,0.2);
}
.achievement-item.locked { opacity: 0.5; }
.ach-icon { font-size: 1.8rem; margin-bottom: 5px; }
.ach-title { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }
.ach-desc { font-size: 0.62rem; color: var(--text-muted); line-height: 1.3; margin-bottom: 5px; }
.ach-badge { font-size: 0.62rem; background: var(--gold); color: #fff; border-radius: 10px; padding: 2px 7px; display: inline-block; font-weight: 600; }
.ach-lock { font-size: 0.85rem; }

/* Couple tab nav 特殊样式 */
.tab-couple { position: relative; }
.tab-couple.active i { color: #E11D48 !important; }

/* food-select-card 减少内边距顶部 */
.food-select-card { padding-top: 10px; }
.food-cat-header { margin-bottom: 10px; }

/* select 样式 */
select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
select:focus { border-color: var(--primary); }

/* ============================================================
   V2.0 情侣共享看板增强样式
   ============================================================ */

/* ---- 今日赢家 ---- */
.winner-badge {
  background: linear-gradient(135deg, var(--primary-light), #FFF0F3);
  border: 1.5px solid var(--primary-mid);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.winner-badge strong { color: var(--primary-dark); }
.info-badge {
  background: var(--gold-light);
  border-color: var(--gold-mid);
  color: var(--gold-dark);
}

/* ---- 共同目标 ---- */
.goal-display { padding: 4px 0; }
.goal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.goal-name { font-size: 1rem; font-weight: 700; color: var(--primary-dark); }
.goal-deadline { font-size: 0.75rem; color: var(--text-muted); }
.goal-target { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 10px; }
.goal-progress-bar {
  height: 10px;
  background: var(--bg);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 4px;
}
.goal-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary), #06D6A0);
  border-radius: 5px;
  transition: width 1s ease;
}
.goal-pct { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 10px; text-align: right; }
.goal-users-row { display: flex; gap: 12px; margin-bottom: 8px; }
.goal-user {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 600;
}
.goal-total { font-size: 0.82rem; color: var(--text-secondary); text-align: center; padding: 6px 0; }

/* ---- 留言墙 (重新设计) ---- */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.msg-me    { flex-direction: row-reverse; }
.msg-other { flex-direction: row; }
.msg-avatar { font-size: 1.4rem; flex-shrink: 0; }
.msg-bubble {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.45;
}
.msg-me .msg-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-other .msg-bubble {
  background: var(--bg);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}
.msg-name { font-size: 0.68rem; font-weight: 700; margin-bottom: 2px; opacity: 0.75; }
.msg-me .msg-name { color: rgba(255,255,255,0.8); }
.msg-text { }
.msg-time { font-size: 0.6rem; opacity: 0.6; margin-top: 3px; }
.msg-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 2px;
  flex-shrink: 0;
  transition: color var(--transition);
}
.msg-del:hover { color: var(--red); }

/* ---- 成就系统 (重新设计) ---- */
.achievement-item.earned {
  border-color: var(--gold);
  background: linear-gradient(135deg, var(--gold-light), #FFFBEB);
  box-shadow: 0 2px 8px rgba(212,160,23,0.2);
}
.achievement-item.locked { opacity: 0.45; filter: grayscale(0.5); }
.ach-label { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); margin-bottom: 3px; display: block; }
.ach-check { color: var(--gold); font-size: 0.85rem; margin-top: 4px; }
.ach-lock  { color: var(--text-muted); font-size: 0.75rem; margin-top: 4px; }

/* ---- 食物搜索结果空态 ---- */
.food-search-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 28px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.food-search-empty i { font-size: 2rem; display: block; margin-bottom: 8px; color: var(--primary-mid); }
.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  font-family: inherit;
}

/* ---- 自定义食物标签 ---- */
.custom-tag {
  font-size: 0.58rem;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 1px 5px;
  margin-left: 3px;
  font-weight: 600;
  vertical-align: middle;
}
.food-custom { border-color: var(--primary-mid) !important; }

/* ---- 历史记录增强 ---- */
.hist-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.hist-date { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.hist-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}
.hist-intake { color: #3A86FF; }
.hist-expend { color: #06D6A0; }
.hist-gap    { }
.hist-foods  { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.hist-food-tag {
  font-size: 0.68rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 8px;
  color: var(--text-secondary);
}

/* ---- 成功卡片 ---- */
.success-card {
  background: linear-gradient(135deg, #F0FDF4, #ECFDF5);
  border: 1.5px solid #86EFAC;
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.success-card i { color: #16A34A; font-size: 1.1rem; margin-top: 2px; }

/* ---- 情侣图表图例 ---- */
.couple-chart-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ---- 里程碑表格 ---- */
.milestone-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.milestone-tbl th {
  background: var(--bg);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}
.milestone-tbl td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.milestone-tbl tr:last-child td { border-bottom: none; }
.milestone-tbl tr:nth-child(even) td { background: var(--bg); }

