:root {
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --text: #1C1C1E;
  --text-secondary: #6E6E73;
  --text-tertiary: #8E8E93;
  --separator: rgba(60, 60, 67, 0.12);
  --blue: #007AFF;
  --blue-soft: rgba(0, 122, 255, 0.12);
  --green: #34C759;
  --green-soft: rgba(52, 199, 89, 0.14);
  --orange: #FF9500;
  --orange-soft: rgba(255, 149, 0, 0.15);
  --red: #FF3B30;
  --red-soft: rgba(255, 59, 48, 0.12);
  --purple: #5856D6;
  --purple-soft: rgba(88, 86, 214, 0.12);
  --radius: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  height: 100%;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 顶部栏（固定在顶部不随内容滚动） */
.top-header {
  flex-shrink: 0;
  z-index: 20;
  background: rgba(242, 242, 247, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: calc(env(safe-area-inset-top) + 12px) 18px 10px;
}

.top-header-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.header-date {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.header-title {
  margin: 2px 0 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.15;
}

.header-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--card);
  color: var(--text-secondary);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

/* 主内容区（独立流畅滚动，不带偏底部栏） */
.main-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 6px 16px 24px;
}

.tab-view {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.tab-view.active {
  display: flex;
}

/* 通用卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

/* 星期条 */
.day-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-pill {
  border: none;
  background: var(--card);
  border-radius: 12px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, background 0.15s ease;
}

.day-pill:active {
  transform: scale(0.95);
}

.day-pill .day-name {
  font-size: 12px;
  font-weight: 600;
}

.day-pill .day-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
}

.day-pill.has-plan .day-dot {
  background: #C7C7CC;
}

.day-pill.done-today .day-dot {
  background: var(--green);
}

.day-pill.selected {
  background: var(--blue);
  color: #FFFFFF;
}

.day-pill.selected .day-dot {
  background: rgba(255, 255, 255, 0.9);
}

.day-pill.is-today:not(.selected) {
  box-shadow: inset 0 0 0 1.5px var(--blue), var(--shadow);
  color: var(--blue);
}

/* 计时器卡片 */
.timer-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.timer-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.plan-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.plan-sub {
  margin-top: 3px;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-badge.idle {
  background: var(--bg);
  color: var(--text-secondary);
}

.status-badge.running {
  background: var(--green-soft);
  color: #1E8E3E;
}

.status-badge.paused {
  background: var(--orange-soft);
  color: #C46B00;
}

.timer-display-block {
  text-align: center;
  padding: 6px 0 2px;
}

.timer-main-num {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.timer-meta-row {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.timer-meta-row .dot {
  margin: 0 6px;
}

.progress-track {
  margin-top: 12px;
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 0.35s ease;
}

/* 打断状态条 */
.interrupt-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 12px;
}

.interrupt-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.interrupt-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.interrupt-item strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.interrupt-divider {
  width: 1px;
  height: 22px;
  background: var(--separator);
}

.text-green { color: #1E8E3E; }
.text-orange { color: #C46B00; }

/* 计时控制按钮 */
.timer-controls {
  display: flex;
  gap: 10px;
}

.btn {
  border: none;
  border-radius: 13px;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.btn-blue { background: var(--blue); color: #FFFFFF; }
.btn-green { background: var(--green); color: #FFFFFF; }
.btn-orange { background: var(--orange); color: #FFFFFF; }
.btn-soft { background: var(--bg); color: var(--text); }
.btn-finish { background: var(--blue-soft); color: var(--blue); flex: 0.85; }

.timer-adjust-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--separator);
}

.adjust-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.adjust-btns {
  display: flex;
  gap: 8px;
}

.chip-btn {
  flex: 1;
  border: none;
  background: var(--bg);
  color: var(--text);
  border-radius: 9px;
  padding: 7px 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.chip-btn.danger-text {
  color: var(--red);
  background: var(--red-soft);
}

/* 组间休息卡片 */
.rest-card {
  padding: 13px 16px;
}

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

.rest-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rest-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.rest-hint {
  font-size: 11.5px;
  color: var(--text-tertiary);
  line-height: 1.2;
}

.rest-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.switch-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.switch-inline input {
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
}

.rest-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rest-num {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 82px;
}

.rest-presets {
  display: flex;
  gap: 5px;
}

.preset-btn {
  border: none;
  background: var(--bg);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.preset-btn.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.rest-action-btn {
  border: none;
  background: var(--text);
  color: #FFFFFF;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-width: 64px;
}

.rest-action-btn.running {
  background: var(--orange);
}

.rest-banner {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--green-soft);
  color: #1E8E3E;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rest-banner.warn {
  background: var(--orange-soft);
  color: #C46B00;
}

.sound-test-btn {
  border: none;
  background: var(--bg);
  color: var(--text);
  border-radius: 9px;
  padding: 5px 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sound-test-btn:active {
  opacity: 0.75;
}

.sound-option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.sound-opt-btn {
  border: 1.5px solid var(--separator);
  background: #FFFFFF;
  color: var(--text);
  border-radius: 11px;
  padding: 10px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sound-opt-btn span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.sound-opt-btn.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.sound-opt-btn.active span {
  color: var(--blue);
  opacity: 0.8;
}

.setting-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--separator);
  font-size: 14px;
  font-weight: 600;
}

.setting-toggle-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.undo-strip {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--separator);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.undo-link-btn {
  border: none;
  background: var(--blue-soft);
  color: var(--blue);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* 区块标题 */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 4px 0;
}

.section-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.text-btn {
  border: none;
  background: transparent;
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 6px;
  cursor: pointer;
}

.muted-label {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* 动作卡片列表 */
.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.exercise-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: opacity 0.2s ease;
}

.exercise-card.all-done {
  background: #F8FFF9;
  box-shadow: inset 0 0 0 1px rgba(52, 199, 89, 0.28), var(--shadow);
}

.ex-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.ex-top-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.video-pill-btn {
  border: none;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: transform 0.12s ease, opacity 0.15s ease;
}

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

.video-pill-btn.has-video {
  background: var(--blue-soft);
  color: var(--blue);
}

.video-pill-btn.no-video {
  background: var(--bg);
  color: var(--text-secondary);
}

/* 视频教学弹窗 */
.video-box {
  background: var(--bg);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.video-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.video-box-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.video-platform-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
}

.video-url-preview {
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-all;
  margin-bottom: 10px;
}

.video-link-cta {
  text-decoration: none;
  width: 100%;
  margin-bottom: 8px;
}

.video-player-wrap {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  margin-bottom: 10px;
}

.video-player-wrap video {
  width: 100%;
  max-height: 320px;
  display: block;
}

.video-player-wrap iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  display: block;
}

.video-quick-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-search-link {
  flex: 1;
  text-decoration: none;
  text-align: center;
  background: var(--bg);
  color: var(--blue);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 600;
}

/* iOS 分段切换（动图示范 | 教学视频） */
.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg);
  border-radius: 11px;
  padding: 3px;
  margin-bottom: 14px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg-btn.active {
  background: #FFFFFF;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.seg-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

/* 零重影高清关键帧动图播放器 */
.motion-stage {
  position: relative;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 3 / 4;
  margin: 0 auto 12px;
  border-radius: 16px;
  overflow: hidden;
  background: #EFF0F4;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.motion-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 75ms linear;
  pointer-events: none;
}

.motion-frame.visible {
  opacity: 1;
}

.motion-overlay-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 100ms ease;
}

.motion-overlay-svg.visible {
  opacity: 1;
}

.motion-phase-pill {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  background: rgba(28, 28, 30, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.motion-phase-pill.peak {
  color: #4ADE80;
}

.motion-progress-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3.5px;
  background: rgba(0, 0, 0, 0.08);
}

.motion-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
}

.motion-progress-fill.peak {
  background: var(--green);
}

.motion-controls-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.motion-ctrl-btn {
  border: none;
  background: var(--bg);
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 8px 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.motion-ctrl-btn.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.motion-sub-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.motion-cues-card {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 14px;
}

.motion-cues-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.motion-cues-list {
  margin: 0;
  padding-left: 16px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.motion-cues-list li {
  margin-bottom: 4px;
}

.motion-cues-list li:last-child {
  margin-bottom: 0;
}

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

.ex-name {
  font-size: 16px;
  font-weight: 700;
}

.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
}

.tag-back { background: var(--blue-soft); color: var(--blue); }
.tag-shoulder { background: var(--purple-soft); color: var(--purple); }
.tag-scapula { background: var(--green-soft); color: #1E8E3E; }
.tag-other { background: var(--bg); color: var(--text-secondary); }

.ex-tip {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.ex-inputs-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.ex-last-badge {
  font-size: 12px;
  color: var(--text-tertiary);
}

.ex-weight-box {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border-radius: 9px;
  padding: 4px 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.ex-weight-input {
  width: 54px;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  outline: none;
}

.sets-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.set-pill {
  border: 1.5px solid #D1D1D6;
  background: #FFFFFF;
  color: var(--text);
  border-radius: 11px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.set-pill:active {
  transform: scale(0.95);
}

.set-pill.done {
  border-color: var(--green);
  background: var(--green);
  color: #FFFFFF;
}

.set-add-btn {
  border: 1.5px dashed #C7C7CC;
  background: transparent;
  color: var(--blue);
  border-radius: 11px;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.set-add-btn:active {
  background: var(--blue-soft);
}

.set-sub-btn {
  border: none;
  background: var(--bg);
  color: var(--text-tertiary);
  border-radius: 11px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.all-done-banner {
  background: var(--green-soft);
  border: 1px solid rgba(52, 199, 89, 0.25);
  border-radius: var(--radius);
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.all-done-title {
  font-size: 15px;
  font-weight: 700;
  color: #1E8E3E;
}

.all-done-desc {
  font-size: 13px;
  line-height: 1.45;
  color: #166534;
  margin: 0;
}

.rest-day-card {
  text-align: center;
  padding: 28px 20px;
}

.rest-day-emoji {
  font-size: 36px;
  margin-bottom: 8px;
}

.rest-day-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.rest-day-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 16px;
}

/* Tab 2: 每周计划 */
.info-banner {
  background: var(--blue-soft);
  border-radius: 14px;
  padding: 13px 15px;
}

.info-banner-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 4px;
}

.info-banner p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #1D4ED8;
}

.plan-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-day-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.plan-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.plan-day-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.plan-weekday-badge {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  background: var(--blue-soft);
  color: var(--blue);
  flex-shrink: 0;
}

.plan-weekday-badge.rest {
  background: var(--bg);
  color: var(--text-tertiary);
}

.plan-day-title {
  font-size: 15px;
  font-weight: 700;
}

.plan-day-meta {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.plan-edit-btn {
  border: none;
  background: var(--bg);
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 9px;
  cursor: pointer;
}

.plan-ex-preview {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--separator);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.plan-ex-chip {
  font-size: 12px;
  background: var(--bg);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 7px;
}

.plan-footer-actions {
  margin-top: 6px;
}

.secondary-full-btn {
  width: 100%;
  border: none;
  background: var(--card);
  color: var(--red);
  border-radius: 13px;
  padding: 13px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  cursor: pointer;
}

/* Tab 3: 统计与日历 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  text-align: center;
}

.stat-box {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 6px;
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.stat-value {
  margin: 4px 0 2px;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stat-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}

.week-dots {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.week-dot-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.week-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg);
  color: var(--text-tertiary);
}

.week-circle.done {
  background: var(--green);
  color: #FFFFFF;
}

.week-circle.planned {
  box-shadow: inset 0 0 0 1.5px #C7C7CC;
}

/* 极简体重记录卡片 */
.weight-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.weight-title {
  font-size: 16px;
  font-weight: 700;
}

.weight-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.weight-delta-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-secondary);
  white-space: nowrap;
}

.weight-delta-badge.up {
  background: var(--green-soft);
  color: #1E8E3E;
}

.weight-delta-badge.down {
  background: var(--orange-soft);
  color: #C46B00;
}

.weight-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.weight-field {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg);
  border-radius: 10px;
  padding: 0 12px;
}

.weight-field input {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  outline: none;
}

.weight-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-left: 6px;
}

.weight-chart-wrap {
  margin-top: 12px;
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 10px 6px;
}

.weight-recent-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
}

.weight-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 2px;
  border-bottom: 1px solid var(--separator);
  font-size: 13.5px;
}

.weight-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.weight-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weight-row-date {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.weight-row-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.weight-row-diff {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.weight-row-diff.up { color: #1E8E3E; }
.weight-row-diff.down { color: #C46B00; }
.weight-row-diff.flat { color: var(--text-tertiary); }

/* 日历 */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.icon-btn {
  border: none;
  background: var(--bg);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 18px;
  cursor: pointer;
}

.calendar-weekdays, .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  gap: 4px;
}

.calendar-weekdays {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.cal-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  position: relative;
  color: var(--text);
}

.cal-cell.empty {
  visibility: hidden;
}

.cal-cell.today {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.cal-cell.has-log {
  background: var(--green-soft);
  color: #1E8E3E;
  font-weight: 700;
}

.cal-cell.today.has-log {
  background: var(--green);
  color: #FFFFFF;
}

/* 历史列表 */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.history-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.history-title {
  font-size: 15px;
  font-weight: 700;
}

.history-date {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.history-metrics {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metric-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--bg);
  color: var(--text-secondary);
}

.metric-chip.green { background: var(--green-soft); color: #1E8E3E; }
.metric-chip.orange { background: var(--orange-soft); color: #C46B00; }

.history-note {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 8px 10px;
  border-radius: 9px;
}

.empty-state {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-tertiary);
  font-size: 14px;
  background: var(--card);
  border-radius: var(--radius);
}

/* 工具卡片 */
.tools-card {
  padding: 14px 16px;
}

.tool-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tool-info {
  flex: 1;
}

.tool-title {
  font-size: 15px;
  font-weight: 600;
}

.tool-desc {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-secondary);
}

.tool-divider {
  height: 1px;
  background: var(--separator);
  margin: 14px 0;
}

.tool-action-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-input {
  border: 1px solid var(--separator);
  background: var(--bg);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.small-primary-btn, .small-secondary-btn {
  border: none;
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.small-primary-btn {
  background: var(--blue);
  color: #FFFFFF;
}

.small-secondary-btn {
  background: var(--bg);
  color: var(--text);
}

/* 底部导航（锁死在 Flex 底部，iPhone 滑动绝不偏移） */
.tab-bar {
  flex-shrink: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--separator);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px);
  z-index: 30;
}

.tab-item {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
}

.tab-item.active {
  color: var(--blue);
}

.tab-icon {
  width: 23px;
  height: 23px;
}

/* 弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.36);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(env(safe-area-inset-bottom) + 20px);
  box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.14);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  border: 1px solid #D1D1D6;
  background: #FAFAFC;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--blue);
  background: #FFFFFF;
}

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

.edit-ex-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.edit-ex-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border-radius: 11px;
  padding: 10px 12px;
}

.edit-ex-info {
  flex: 1;
}

.edit-ex-name {
  font-size: 14px;
  font-weight: 600;
}

.edit-ex-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.del-btn {
  border: none;
  background: var(--red-soft);
  color: var(--red);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.modal-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}

/* Toast */
.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  background: rgba(28, 28, 30, 0.92);
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
}
