* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  background: #f5f5f7;
  color: #1d1d1f;
  overflow: hidden;
}

input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

#app {
  height: 100%;
  position: relative;
}

.view {
  display: none;
  height: 100%;
  width: 100%;
}
.view.active { display: flex; flex-direction: column; }

:root {
  --primary: #2dd4bf;
  --primary-dark: #14b8a6;
  --primary-light: #5eead4;
  --primary-gradient: linear-gradient(135deg, #2dd4bf 0%, #06b6d4 100%);
  --primary-soft: #ccfbf1;
}

body.theme-orange {
  --primary: #fb923c;
  --primary-dark: #f97316;
  --primary-light: #fdba74;
  --primary-gradient: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
  --primary-soft: #ffedd5;
}

body.theme-purple {
  --primary: #a78bfa;
  --primary-dark: #8b5cf6;
  --primary-light: #c4b5fd;
  --primary-gradient: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  --primary-soft: #ede9fe;
}

body.theme-green {
  --primary: #4ade80;
  --primary-dark: #22c55e;
  --primary-light: #86efac;
  --primary-gradient: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
  --primary-soft: #dcfce7;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0 20px;
  height: 48px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-width: 80px;
  transition: transform 0.1s, opacity 0.1s;
}
.btn-primary:active { transform: scale(0.96); opacity: 0.9; }
.btn-large { width: 100%; height: 52px; font-size: 17px; }

.btn-outline {
  background: #fff;
  color: var(--primary-dark);
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 0 20px;
  height: 48px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-width: 80px;
  transition: transform 0.1s;
}
.btn-outline:active { transform: scale(0.96); }

.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:active { opacity: 0.8; }

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.toast.show { opacity: 1; }

.auth-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: linear-gradient(180deg, var(--primary-soft) 0%, #f5f5f7 40%);
}

.auth-logo {
  font-size: 72px;
  margin-bottom: 16px;
}

.auth-title {
  font-size: 32px;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 15px;
  color: #86868b;
  margin-bottom: 40px;
}

.auth-tabs {
  display: flex;
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.auth-tab {
  flex: 1;
  height: 44px;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: #86868b;
  border-radius: 10px;
  cursor: pointer;
}
.auth-tab.active {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.auth-form {
  display: none;
  width: 100%;
  max-width: 360px;
  flex-direction: column;
  gap: 14px;
}
.auth-form.active { display: flex; }

.auth-form input {
  width: 100%;
  height: 52px;
  border: 2px solid #e5e5ea;
  border-radius: 12px;
  padding: 0 16px;
  font-size: 16px;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}
.auth-form input:focus { border-color: var(--primary); }

.page {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}
.page.active { display: flex; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  padding-top: calc(env(safe-area-inset-top) + 16px);
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-title { font-size: 18px; font-weight: 700; }
.header-sub { font-size: 12px; color: #86868b; margin-top: 2px; }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.bottom-nav {
  display: flex;
  background: #fff;
  border-top: 1px solid #f0f0f0;
  padding-bottom: env(safe-area-inset-bottom);
  flex-shrink: 0;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  gap: 2px;
  color: #86868b;
  cursor: pointer;
  min-height: 56px;
}
.nav-item.active { color: var(--primary-dark); }
.nav-icon { font-size: 22px; }
.nav-label { font-size: 11px; font-weight: 600; }

.task-filter {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.filter-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 20px;
  background: #f5f5f7;
  font-size: 14px;
  font-weight: 600;
  color: #86868b;
  cursor: pointer;
  height: 40px;
}
.filter-btn.active {
  background: var(--primary-gradient);
  color: #fff;
}

.task-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border-radius: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.task-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid #d1d1d6;
  flex-shrink: 0;
  cursor: pointer;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  transition: all 0.2s;
}
.task-check.checked {
  background: var(--primary-gradient);
  border-color: var(--primary-dark);
}

.task-content {
  flex: 1;
  min-width: 0;
}
.task-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  word-break: break-all;
}
.task-item.completed .task-title {
  text-decoration: line-through;
  color: #86868b;
}
.task-desc {
  font-size: 13px;
  color: #86868b;
  margin-bottom: 6px;
  word-break: break-all;
}
.task-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.task-cat {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}
.task-time {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f5f5f7;
  color: #86868b;
  font-weight: 500;
}

.task-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.task-action-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #f5f5f7;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-action-btn.danger:active { background: #fee2e2; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: #86868b;
}
.empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.5; }
.empty-text { font-size: 15px; }

.friend-tabs {
  display: flex;
  gap: 0;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.friend-tab {
  flex: 1;
  padding: 14px 0;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: #86868b;
  cursor: pointer;
  position: relative;
  min-height: 48px;
}
.friend-tab.active { color: var(--primary-dark); }
.friend-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 30%;
  right: 30%;
  height: 3px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

.ranking-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}
.ranking-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: #f5f5f7;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #86868b;
  cursor: pointer;
  min-height: 44px;
  transition: all .2s;
}
.ranking-tab.active {
  background: var(--primary-gradient);
  color: #fff;
}

.badge {
  display: inline-block;
  background: #ff3b30;
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  margin-left: 2px;
}

.friend-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}
.friend-panel.active { display: block; }

.ranking-list .rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.rank-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f5f5f7;
  color: #86868b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.rank-num.top1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.rank-num.top2 { background: linear-gradient(135deg, #d1d5db, #9ca3af); color: #fff; }
.rank-num.top3 { background: linear-gradient(135deg, #fcd34d, #d97706); color: #fff; }

.rank-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: 15px; font-weight: 600; }
.rank-stats { font-size: 12px; color: #86868b; margin-top: 2px; }

.rank-today {
  text-align: right;
  flex-shrink: 0;
}
.rank-today-num {
  font-size: 20px;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.rank-today-label { font-size: 11px; color: #86868b; }

.friend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  cursor: pointer;
}
.friend-item:active { opacity: 0.8; }

.friend-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.friend-info { flex: 1; min-width: 0; }
.friend-name { font-size: 15px; font-weight: 600; }
.friend-sign { font-size: 12px; color: #86868b; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.request-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.req-info { flex: 1; min-width: 0; }
.req-name { font-size: 15px; font-weight: 600; }
.req-time { font-size: 11px; color: #86868b; margin-top: 2px; }
.req-actions { display: flex; gap: 8px; }
.req-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.req-btn.accept { background: var(--primary-gradient); color: #fff; }
.req-btn.reject { background: #f5f5f7; color: #86868b; }

.stats-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 18px 12px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.stat-num {
  font-size: 28px;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}
.stat-label { font-size: 12px; color: #86868b; font-weight: 500; }

.chart-section {
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 140px;
  gap: 6px;
  padding: 0 4px;
}
.bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}
.bar {
  width: 100%;
  background: var(--primary-gradient);
  border-radius: 6px 6px 2px 2px;
  min-height: 4px;
  max-width: 28px;
}
.bar-label {
  font-size: 10px;
  color: #86868b;
  flex-shrink: 0;
}
.bar-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-dark);
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cat-stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.cat-stat-info { flex: 1; }
.cat-stat-name { font-size: 14px; font-weight: 600; }
.cat-stat-bar {
  height: 8px;
  background: #f5f5f7;
  border-radius: 4px;
  margin-top: 4px;
  overflow: hidden;
}
.cat-stat-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 4px;
}
.cat-stat-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  flex-shrink: 0;
  width: 32px;
  text-align: right;
}

.me-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.me-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.me-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}
.me-info { flex: 1; min-width: 0; }
.me-nickname { font-size: 18px; font-weight: 700; }
.me-username { font-size: 13px; color: #86868b; margin-top: 2px; }

.me-section {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.me-section .section-title { margin-bottom: 12px; }

.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.theme-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.theme-preview {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 3px solid transparent;
}
.theme-item.active .theme-preview { border-color: var(--primary-dark); }
.tiffany-bg { background: linear-gradient(135deg, #2dd4bf 0%, #06b6d4 100%); }
.orange-bg { background: linear-gradient(135deg, #fb923c 0%, #f97316 100%); }
.purple-bg { background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%); }
.green-bg { background: linear-gradient(135deg, #4ade80 0%, #16a34a 100%); }
.theme-item span { font-size: 11px; color: #86868b; font-weight: 500; }

.me-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #f5f5f7;
  cursor: pointer;
  height: 52px;
}
.me-item:last-child { border-bottom: none; }
.me-item:active { opacity: 0.7; }
.me-item span { font-size: 15px; font-weight: 500; }
.me-arrow { color: #c7c7cc; font-size: 20px; font-weight: 300; }

.modal-mask {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  align-items: flex-end;
  justify-content: center;
}
.modal-mask.active { display: flex; }

.modal {
  width: 100%;
  max-width: 500px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.modal-header span { font-size: 17px; font-weight: 700; }
.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: #f5f5f7;
  border-radius: 50%;
  font-size: 20px;
  color: #86868b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.modal-footer button { flex: 1; }

.form-item { margin-bottom: 18px; }
.form-item label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #1d1d1f;
}
.form-item input[type="text"],
.form-item input[type="number"],
.form-item input[type="password"],
.form-item textarea {
  width: 100%;
  min-height: 48px;
  border: 2px solid #e5e5ea;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.form-item textarea { min-height: 80px; resize: none; }
.form-item input:focus, .form-item textarea:focus { border-color: var(--primary); }

.hint { font-size: 12px; color: #86868b; margin-top: 6px; }

.category-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cat-item {
  padding: 8px 14px;
  border-radius: 20px;
  background: #f5f5f7;
  font-size: 13px;
  font-weight: 600;
  color: #86868b;
  cursor: pointer;
  height: 40px;
  display: inline-flex;
  align-items: center;
}
.cat-item.active {
  background: var(--primary-gradient);
  color: #fff;
}

.time-picker {
  display: flex;
  align-items: center;
  gap: 10px;
}
.time-picker input {
  width: 80px;
  text-align: center;
}
.time-picker span {
  font-size: 20px;
  font-weight: 700;
  color: #86868b;
}

.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.search-box input {
  flex: 1;
  height: 48px;
  border: 2px solid #e5e5ea;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 15px;
  outline: none;
}
.search-box input:focus { border-color: var(--primary); }

.search-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.search-user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #f9fafb;
}
.search-user-info { flex: 1; }
.search-user-name { font-size: 15px; font-weight: 600; }
.search-user-sign { font-size: 12px; color: #86868b; margin-top: 2px; }
.add-friend-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: none;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.avatar-opt {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: #f5f5f7;
  border-radius: 12px;
  cursor: pointer;
  border: 2px solid transparent;
}
.avatar-opt.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.notify-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}
.notify-item span { font-size: 15px; font-weight: 500; }
.notify-item .btn-primary,
.notify-item .btn-outline {
  flex: 1;
}

.notify-status {
  background: #f9fafb;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e5e5ea;
}
.status-row:last-child { border-bottom: none; }
.status-row > span:first-child {
  font-size: 14px;
  color: #86868b;
}
.status-val {
  font-size: 14px;
  font-weight: 600;
}
.status-val.ok { color: #34c759; }
.status-val.no { color: #ff3b30; }
.status-val.warn { color: #ff9500; }

.remind-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.remind-toggle-row > span { font-size: 15px; font-weight: 500; }

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 30px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #e5e5ea;
  transition: .3s;
  border-radius: 30px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
input:checked + .slider {
  background: var(--primary-gradient);
}
input:checked + .slider:before {
  transform: translateX(22px);
}

.wheel-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
  margin-bottom: 8px;
  gap: 0;
  overflow: hidden;
  opacity: 0.4;
  pointer-events: none;
  transition: opacity .3s;
}
.wheel-picker.active {
  opacity: 1;
  pointer-events: auto;
}
.wheel-col {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  position: relative;
  -webkit-overflow-scrolling: touch;
}
.wheel-col::-webkit-scrollbar { display: none; }
.wheel-col::before,
.wheel-col::after {
  content: '';
  display: block;
  height: 56px;
}
.wheel-list {
  display: flex;
  flex-direction: column;
}
.wheel-item {
  height: 28px;
  line-height: 28px;
  text-align: center;
  font-size: 18px;
  color: #86868b;
  scroll-snap-align: center;
  transition: all .2s;
  font-weight: 500;
}
.wheel-item.active {
  color: var(--primary);
  font-size: 22px;
  font-weight: 700;
}
.wheel-colon {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  padding: 0 6px;
  margin-top: -2px;
}

.repeat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.repeat-opt {
  flex: 0 0 calc(33.33% - 6px);
  text-align: center;
  padding: 10px 6px;
  background: #f5f5f7;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
  font-weight: 500;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.repeat-opt.active {
  background: var(--primary-gradient);
  color: #fff;
  font-weight: 600;
}

.remind-interval-row {
  display: none;
}
.remind-interval-row.active {
  display: block;
}
.interval-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.interval-opt {
  flex: 0 0 calc(25% - 6px);
  text-align: center;
  padding: 10px 4px;
  background: #f5f5f7;
  border-radius: 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
  font-weight: 500;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.interval-opt.active {
  background: var(--primary-gradient);
  color: #fff;
  font-weight: 600;
}

.task-repeat-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 4px;
  margin-top: 4px;
  font-weight: 500;
}

.friend-detail-header {
  text-align: center;
  padding: 20px 0;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-soft));
  border-radius: 14px;
  margin-bottom: 16px;
}
.friend-detail-avatar {
  font-size: 48px;
  margin-bottom: 8px;
}
.friend-detail-name {
  font-size: 20px;
  font-weight: 700;
  color: #1d1d1f;
}
.friend-detail-username {
  font-size: 13px;
  color: #86868b;
  margin-top: 2px;
}

.friend-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.friend-stat-item {
  text-align: center;
  padding: 14px 8px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.friend-stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}
.friend-stat-label {
  font-size: 12px;
  color: #86868b;
  margin-top: 4px;
}

.friend-detail-section {
  margin-bottom: 20px;
}
.friend-detail-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #1d1d1f;
}

.friend-daily-item {
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.friend-daily-date {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
}
.friend-daily-count {
  font-size: 12px;
  color: #86868b;
  float: right;
}
.friend-task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.friend-task-item {
  display: flex;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
  color: #1d1d1f;
}
.friend-task-item::before {
  content: '✓';
  color: #34c759;
  font-weight: 700;
  margin-right: 8px;
  font-size: 12px;
}
.friend-empty {
  font-size: 13px;
  color: #86868b;
  padding: 10px 0;
}

.remind-quick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.remind-btn {
  padding: 12px 6px;
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #1d1d1f;
  cursor: pointer;
  transition: all .2s;
  min-height: 44px;
}
.remind-btn:active {
  transform: scale(0.96);
  background: var(--primary-soft);
  border-color: var(--primary);
}
.remind-btn.remind-custom {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.diet-week-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
  overflow-x: auto;
}
.diet-week-tab {
  flex: 1;
  min-width: 42px;
  padding: 8px 4px;
  border-radius: 10px;
  background: #f5f5f7;
  color: #86868b;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.diet-week-tab.active {
  background: var(--primary-gradient);
  color: #fff;
}

.diet-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 24px;
  -webkit-overflow-scrolling: touch;
}

.diet-meal-card {
  background: #fff;
  border-radius: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  overflow: hidden;
}
.diet-meal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f5f5f7;
}
.diet-meal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
}
.diet-meal-time {
  font-size: 12px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.diet-meal-add {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  flex-shrink: 0;
  transition: transform .15s;
}
.diet-meal-add:active { transform: scale(0.92); }

.diet-dish-list { padding: 6px 10px 10px; }
.diet-dish-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
}
.diet-dish-item + .diet-dish-item { border-top: 1px solid #f7f7f9; }
.diet-dish-num {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.diet-dish-body { flex: 1; min-width: 0; }
.diet-dish-name {
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
  line-height: 1.4;
  word-break: break-all;
}
.diet-dish-ingredients {
  font-size: 12px;
  color: #86868b;
  margin-top: 4px;
  line-height: 1.5;
  word-break: break-all;
}
.diet-dish-meta { font-size: 10px; color: #c7c7cc; margin-top: 4px; }
.diet-dish-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.diet-dish-btn {
  width: 32px; height: 32px;
  border: none;
  background: #f5f5f7;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.diet-empty {
  padding: 20px 16px;
  text-align: center;
  color: #c7c7cc;
  font-size: 13px;
}
.diet-day-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.diet-day-opt {
  padding: 10px 4px;
  background: #f5f5f7;
  border-radius: 10px;
  font-size: 13px;
  color: #86868b;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.diet-day-opt.active {
  background: var(--primary-gradient);
  color: #fff;
  font-weight: 700;
}
.diet-meal-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.diet-meal-opt {
  padding: 12px 4px;
  background: #f5f5f7;
  border-radius: 10px;
  font-size: 14px;
  color: #86868b;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.diet-meal-opt.active {
  background: var(--primary-gradient);
  color: #fff;
  font-weight: 700;
}
.diet-time-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.diet-time-row input[type="number"] {
  width: 90px;
  height: 56px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-dark);
  border: 2px solid #e5e5ea;
  border-radius: 12px;
  outline: none;
}
.diet-time-row input::-webkit-outer-spin-button,
.diet-time-row input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.diet-time-row input:focus { border-color: var(--primary); }
.diet-time-colon {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

/* ==================== 记事本 ==================== */
.header-back {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--primary-dark);
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.note-search-wrap {
  padding: 12px 16px 8px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.note-search-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 16px;
  border: 1.5px solid #e5e5ea;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  background: #f5f5f7;
}
.note-search-wrap input:focus {
  border-color: var(--primary);
  background: #fff;
}
.note-cat-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.note-cat-tabs::-webkit-scrollbar { display: none; }
.note-cat-tab {
  padding: 6px 14px;
  border-radius: 16px;
  background: #f5f5f7;
  font-size: 13px;
  font-weight: 600;
  color: #86868b;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .2s;
}
.note-cat-tab.active {
  background: var(--primary-gradient);
  color: #fff;
}
.note-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}
.note-item {
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: transform .1s;
}
.note-item:active { transform: scale(0.98); }
.note-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.note-item-cat {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}
.note-item-time {
  font-size: 11px;
  color: #c7c7cc;
}
.note-item-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  word-break: break-all;
}
.note-item-content {
  font-size: 13px;
  color: #86868b;
  line-height: 1.5;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
  opacity: 0.6;
}
.note-action-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #f5f5f7;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.note-action-btn.danger:active { background: #fee2e2; }
.note-cat-item {
  padding: 8px 14px;
  border-radius: 10px;
  background: #f5f5f7;
  font-size: 14px;
  color: #86868b;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.note-cat-item.active {
  background: var(--primary-gradient);
  color: #fff;
  font-weight: 700;
}

/* 搜索框 + 按钮 */
.note-search-wrap {
  display: flex;
  gap: 8px;
  padding: 12px 16px 8px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.note-search-wrap input {
  flex: 1;
  height: 40px;
  padding: 0 16px;
  border: 1.5px solid #e5e5ea;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  background: #f5f5f7;
}
.note-search-wrap input:focus {
  border-color: var(--primary);
  background: #fff;
}
.note-search-btn {
  padding: 0 18px;
  height: 40px;
  border: none;
  border-radius: 20px;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.note-search-btn:active { transform: scale(0.96); }

/* 记事操作按钮：改为始终可见 */
.note-item-actions {
  opacity: 1;
}
.note-item-from {
  font-size: 12px;
  color: #86868b;
  margin-top: 8px;
  font-weight: 500;
}
.btn-small {
  height: 32px;
  min-width: 56px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: 8px;
}

/* 分享弹窗 */
.share-note-info {
  background: var(--primary-soft);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.share-info-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 4px;
}
.share-info-meta {
  font-size: 12px;
  color: #86868b;
}
.share-friend-list {
  max-height: 50vh;
  overflow-y: auto;
}
.share-friend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f5f5f7;
}
.share-friend-info {
  flex: 1;
  min-width: 0;
}
.share-friend-name {
  font-size: 15px;
  font-weight: 600;
}
.share-friend-sign {
  font-size: 12px;
  color: #86868b;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 分享详情 */
.shared-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.shared-detail-cat {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}
.shared-detail-time {
  font-size: 12px;
  color: #c7c7cc;
}
.shared-detail-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  word-break: break-all;
}
.shared-detail-from {
  font-size: 13px;
  color: #86868b;
  margin-bottom: 16px;
}
.shared-detail-content {
  font-size: 15px;
  line-height: 1.7;
  color: #333;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 50vh;
  overflow-y: auto;
  padding: 12px;
  background: #fafafa;
  border-radius: 10px;
  margin-bottom: 16px;
}
.shared-detail-actions {
  display: flex;
  justify-content: center;
}

@media (min-width: 500px) {
  .modal-mask { align-items: center; }
  .modal { border-radius: 20px; max-height: 80vh; }
}
