/* ============================================================
   FitLog — 移动端健身助手
   单列卡片 · 底部标签 · 跟随系统深浅色
   ============================================================ */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --field: #f5f6f8;
  --ink: #15171c;
  --ink-soft: #3d434d;
  --muted: #71767f;
  --line: #e5e8ed;
  --accent: #0f9d63;
  --accent-strong: #0b7a4d;
  --accent-ink: #0a6c45;
  --accent-soft: #e4f6ed;
  --danger: #cf3f3f;
  --danger-soft: #fdeceb;
  --warn: #a45b00;
  --warn-soft: #fdf3e3;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .04);
  --tabbar-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #171a20;
    --field: #101319;
    --ink: #eceff4;
    --ink-soft: #c8cdd6;
    --muted: #9aa1ad;
    --line: #262b33;
    --accent: #2fbf88;
    --accent-strong: #14a06c;
    --accent-ink: #7ee2b8;
    --accent-soft: #12301f;
    --danger: #ff8080;
    --danger-soft: #2a1618;
    --warn: #f0b46b;
    --warn-soft: #2a2114;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
}

body.no-scroll { overflow: hidden; }

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 14px;
}

/* ---------- 顶部 ---------- */
.app-bar { padding: calc(22px + env(safe-area-inset-top)) 4px 14px; }

.app-bar h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.25;
  letter-spacing: .3px;
  font-weight: 700;
}

.summary { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

.page { display: flex; flex-direction: column; gap: 14px; }
.page[hidden] { display: none; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .2px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.card-head .card-title { margin-bottom: 0; }

.pill {
  font-size: 12px;
  color: var(--muted);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pill-ai {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: transparent;
  font-weight: 600;
}

.hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.hint-tight { margin: -4px 0 14px; font-size: 12px; }

/* ---------- 同步 ---------- */.sync-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.sync-code {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  overflow-x: auto;
  white-space: nowrap;
}

.sync-state {
  margin: 0 0 4px;
  font-size: 12.5px;
  color: var(--muted);
}
.empty-hint { padding: 18px 4px; text-align: center; }

.count-note { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field:last-of-type { margin-bottom: 16px; }

.label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.input {
  display: block;
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.input::placeholder { color: var(--muted); opacity: .8; }

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.textarea {
  height: auto;
  min-height: 64px;
  padding: 11px 12px;
  line-height: 1.45;
  resize: none;
}

/* ---------- 输入提示 ---------- */
.input-tip {
  margin: 7px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

select.input {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

input[type="date"] { min-height: 46px; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }

.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }
.input-row .btn { flex: 0 0 auto; width: auto; padding: 0 14px; }

.row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.row-2 .field { margin-bottom: 12px; }
.row-3 .field { margin-bottom: 0; }
.row-3 .input { padding: 0 10px; text-align: center; }
.row-3 .label { text-align: center; }

/* ---------- 选项标签 ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.chips:last-child { margin-bottom: 0; }

.chip {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.chip-sm { min-height: 32px; padding: 0 11px; font-size: 13px; }

.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ---------- 按钮 ---------- */
.btn {
  display: block;
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, background-color .15s ease, opacity .15s ease;
}

.btn:active { transform: scale(.99); }
.btn[disabled] { opacity: .55; cursor: default; }

.btn-primary { background: var(--accent-strong); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }

.btn-quiet {
  min-height: 44px;
  background: var(--field);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.btn-quiet:hover { border-color: var(--accent); color: var(--accent-ink); }

.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; width: auto; }

.btn-ghost-danger {
  min-height: 44px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
}

.btn-ghost-danger:hover { background: var(--danger-soft); }

.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.btn-row .btn { flex: 1; }

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 错误 ---------- */
.err { margin: 7px 0 0; font-size: 12.5px; color: var(--danger); }

.input.is-invalid { border-color: var(--danger); }
.input.is-invalid:focus { box-shadow: 0 0 0 3px var(--danger-soft); }

/* ---------- 记录列表 ---------- */
.history { margin-top: 12px; }

.rec-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rec {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--field);
}

.rec-body { flex: 1; min-width: 0; }

.rec-name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }

.tag {
  display: inline-block;
  margin-left: 7px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 600;
  vertical-align: 1px;
}

.tag-soft { background: var(--accent-soft); color: var(--accent-ink); }

.tag-plain {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 500;
}

.rec-meta {
  margin-top: 3px;
  font-size: 13px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.rec-feel { margin-top: 4px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }

.rec-del {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.rec-del:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- 空状态 ---------- */
.empty { padding: 22px 10px 18px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 28px; line-height: 1; }
.empty-text { margin: 10px 0 0; font-size: 13.5px; }

/* ---------- 体重记录 ---------- */
.wlog { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.wlog-title { margin: 0 0 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }

.wlog-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.wlog-date { color: var(--muted); width: 56px; }
.wlog-val { font-weight: 600; }
.wlog-delta { margin-left: auto; font-size: 12.5px; }
.wlog-delta.up { color: var(--danger); }
.wlog-delta.down { color: var(--accent-ink); }

/* ---------- 日历 ---------- */
.month-nav { display: flex; align-items: center; gap: 2px; }

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover { background: var(--field); color: var(--ink); }

.month-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  min-width: 74px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: 14px 0 6px;
}

.cal-wd {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-cell {
  position: relative;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .12s ease;
}

.cal-cell.is-blank { cursor: default; }

.cal-cell.has-record {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.cal-cell.is-today { border-color: var(--accent); }

.cal-cell.is-selected {
  background: var(--accent-strong);
  color: #fff;
  border-color: var(--accent-strong);
}

.cal-cell.is-selected .cal-dot { background: #fff; }

.cal-dot {
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
  display: inline-block;
}

.dot-on { background: var(--accent); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.stat-cell { text-align: center; }
.stat-v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-k { margin-top: 2px; font-size: 11.5px; color: var(--muted); }

.cal-detail { margin-top: 14px; }

.cal-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.cal-detail-date { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }

.link-btn {
  border: none;
  background: transparent;
  color: var(--accent-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 2px;
  cursor: pointer;
}

/* ---------- 部位分布 ---------- */
.bars { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }

.bar-row { display: flex; align-items: center; gap: 10px; }

.bar-label { width: 34px; font-size: 13px; color: var(--ink-soft); flex: 0 0 auto; }

.bar-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--field);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: 999px;
  background: var(--accent);
  transition: width .25s ease;
}

.bar-val {
  width: 22px;
  text-align: right;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

/* ---------- 动作库 ---------- */
.ex-list { display: flex; flex-direction: column; gap: 12px; }

.ex-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.ex-head { display: flex; align-items: center; gap: 8px; }
.ex-name { margin: 0; font-size: 15.5px; font-weight: 700; }

.ex-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}

.ex-meta .tag { margin-left: 0; }
.ex-dose { margin-left: auto; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.ex-cues {
  margin: 9px 0 11px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- 底部标签 ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.tab svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab.is-active { color: var(--accent-ink); font-weight: 600; }

/* ---------- 动作选择弹层 ---------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(12, 15, 20, .45);
  animation: fade .18s ease;
}

.sheet[hidden] { display: none; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet-panel {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  background: var(--card);
  border-radius: 20px 20px 0 0;
  animation: rise .22s ease;
}

@keyframes rise { from { transform: translateY(18px); } to { transform: translateY(0); } }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-head h2 { margin: 0; font-size: 16px; font-weight: 700; }

.sheet-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 4px;
}

.sheet-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sheet-item:hover { border-color: var(--accent); }

.sheet-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sheet-item-name { font-size: 14.5px; font-weight: 600; }
.sheet-item-sub { font-size: 12px; color: var(--muted); }
.sheet-item-go { font-size: 18px; color: var(--accent-ink); }

/* ---------- AI 计划 ---------- */
.ai-warn {
  margin: 10px 0 0;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12.5px;
  line-height: 1.5;
}

.plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plan-head .card-title { margin-bottom: 0; }

.plan-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.plan-meta .tag { margin-left: 0; }

.plan-summary {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.plan-warm {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--field);
  font-size: 12.5px;
  line-height: 1.5;
}

.plan-warm-k { flex: 0 0 auto; font-weight: 600; color: var(--accent-ink); }
.plan-warm-v { color: var(--muted); }

.plan-items {
  list-style: none;
  counter-reset: plan;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-item {
  counter-increment: plan;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--field);
}

.plan-item-main { flex: 1; min-width: 0; }

.plan-item-name { font-size: 14.5px; font-weight: 600; }

.plan-item-name::before {
  content: counter(plan) ".";
  margin-right: 6px;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.plan-item-dose {
  margin-top: 3px;
  font-size: 13px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.plan-item-weight { margin-top: 2px; font-size: 12.5px; color: var(--accent-ink); font-weight: 600; }
.plan-item-note { margin-top: 2px; font-size: 12px; color: var(--muted); }

.plan-tips {
  margin: 14px 0 0;
  padding: 12px 12px 12px 28px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12.5px;
  line-height: 1.6;
}

.plan-tips li + li { margin-top: 5px; }

.setting summary {
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  list-style: none;
}

.setting summary::-webkit-details-marker { display: none; }

.setting summary::after {
  content: "▾";
  float: right;
  color: var(--muted);
  transition: transform .15s ease;
}

.setting[open] summary::after { transform: rotate(180deg); }
.setting[open] summary { margin-bottom: 4px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 32px);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: #1b1f27;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast[hidden] { display: none; }
.toast-msg { min-width: 0; }

.toast-action {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: #7ee2b8;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 2px;
  cursor: pointer;
}

/* ---------- 大屏 ---------- */
@media (min-width: 560px) {
  .app-bar { padding-top: 34px; }
  .card { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
  }
}

/* ==========================================================
   计划执行 / 打勾
   ========================================================== */

.plan-marks {
  display: flex;
  gap: 6px;
  flex: none;
}

.mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.mark-ok:hover { color: var(--accent); border-color: var(--accent); }
.mark-no:hover { color: var(--danger); border-color: var(--danger); }

.mark-ok.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.mark-no.is-on {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.plan-item.is-done .plan-item-name { color: var(--accent-ink); }
.plan-item.is-skip { opacity: .55; }
.plan-item.is-skip .plan-item-name { text-decoration: line-through; }

.plan-progress {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.btn-row-wrap { flex-wrap: wrap; }

.review-line {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.review-line:last-of-type { margin-bottom: 12px; }

/* ==========================================================
   一起练（同伴）
   ========================================================== */

.team-list { display: grid; gap: 10px; margin-top: 12px; }

.member {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
}

.member-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.member-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.member-del {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.member-del:hover { color: var(--danger); background: var(--danger-soft); }

.member-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.member-cell { text-align: center; }

.member-k {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.member-v {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.member-err {
  margin: 0;
  font-size: 12.5px;
  color: var(--warn);
}

.member-ts {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* ==========================================================
   身体数据对比
   ========================================================== */

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cmp-body { margin-top: 12px; }

.cmp-rows { display: grid; gap: 8px; }

.cmp-row {
  display: grid;
  grid-template-columns: 64px 1fr 18px 1fr auto;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.cmp-k { color: var(--muted); }

.cmp-v {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.cmp-v-wide {
  grid-column: 2 / -1;
  color: var(--ink-soft);
}

.cmp-arrow { color: var(--muted); text-align: center; }

.cmp-d {
  min-width: 62px;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cmp-d.is-good { color: var(--accent); }
.cmp-d.is-warn { color: var(--warn); }
.cmp-d.is-flat { color: var(--muted); }

.cmp-rows-plain {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

@media (max-width: 340px) {
  .member-grid { grid-template-columns: repeat(2, 1fr); }
  .cmp-row { grid-template-columns: 56px 1fr 14px 1fr auto; }
}


/* ==========================================================
   计划继续调整
   ========================================================== */

.refine {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.refine-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.refine-label {
  font-size: 12.5px;
  color: var(--muted);
}

.refine-count {
  font-size: 11.5px;
  color: var(--accent-ink);
}

.refine-row {
  display: flex;
  gap: 8px;
}

.refine-input {
  flex: 1;
  min-width: 0;
  font-size: 14px;
}

.refine-send {
  flex: none;
  padding: 0 16px;
}

.refine-chips {
  margin: 8px 0 0;
}

.refine-chips .chip {
  font-size: 12px;
  min-height: 30px;
  padding: 0 10px;
}

.refine-log {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}


/* 对话式调整 */
.refine-chat {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.refine-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.55;
}

.refine-who {
  flex: none;
  min-width: 26px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--field);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.refine-msg.is-me .refine-who {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-ink);
}

.refine-text { color: var(--ink-soft); }

.refine-msg.is-me .refine-text { color: var(--ink); }

.refine-send:disabled { opacity: .55; }

/* ==========================================================
   3D 动作演示
   ========================================================== */

.ex-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.motion-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 12, 18, .58);
  backdrop-filter: blur(2px);
}

.motion-sheet {
  width: min(430px, 100%);
  padding: 14px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}

.motion-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.motion-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.motion-sub {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.motion-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: var(--field);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.motion-canvas {
  display: block;
  width: 100%;
  height: 300px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 18%, rgba(47, 191, 136, .10), transparent 60%),
    var(--field);
  touch-action: none;
  cursor: grab;
}

.motion-canvas:active { cursor: grabbing; }

.motion-cue {
  margin: 10px 2px 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.motion-hint {
  margin: 8px 0 0;
  font-size: 11.5px;
  text-align: center;
  color: var(--muted);
}
/* 真人示范 */
.motion-video {
  display: block;
  width: 100%;
  height: 300px;
  border-radius: 12px;
  background: #000;
  object-fit: contain;
}

.motion-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.motion-link {
  flex: 1 1 0;
  min-width: 0;
  padding: 9px 4px;
  border-radius: 10px;
  background: var(--field);
  color: var(--ink-soft);
  font-size: 11.5px;
  white-space: nowrap;
  text-align: center;
  text-decoration: none;
  border: 1px solid var(--line);
}

.motion-link:active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.motion-note {
  margin: 8px 2px 0;
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
}
.motion-dose {
  margin: 6px 2px 12px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ==========================================================
   力量进展
   ========================================================== */

.str-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 4px 0 10px;
}

.str-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  border-radius: 12px;
  background: var(--field);
  text-align: center;
}

.str-tile-k {
  font-size: 11px;
  color: var(--muted);
}

.str-tile-v {
  font-size: 15px;
  color: var(--ink);
}

.str-tile-d {
  font-size: 10.5px;
  color: var(--muted);
}

.str-delta {
  margin: 0 2px 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.str-delta.up { color: var(--accent-ink); }
.str-delta.down { color: #b45309; }

.str-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding: 6px 2px 0;
}

.str-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  gap: 4px;
  min-width: 0;
}

.str-bar-fill {
  width: 100%;
  max-width: 26px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent), rgba(47, 191, 136, .35));
}

.str-bar-lab {
  font-size: 9.5px;
  color: var(--muted);
  white-space: nowrap;
}
.str-bar {
  position: relative;
}

.str-bar-val {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1;
  margin-bottom: 2px;
}

.str-bar-fill {
  flex: 0 0 auto;
}

.str-bar {
  height: 100%;
}
.str-tile-s {
  font-size: 10.5px;
  color: var(--muted);
}
/* 计划项里的真人示范入口 */
.plan-item-name.is-tappable {
  cursor: pointer;
}

.plan-item-demo {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
  vertical-align: middle;
}

.plan-item-name.is-tappable:active .plan-item-demo {
  opacity: .7;
}
/* 已写入 / 禁用态 */
.plan-item.is-written {
  opacity: .72;
}

.plan-item-written {
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--field);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
  vertical-align: middle;
}

.btn.is-disabled,
.btn:disabled {
  opacity: .45;
  pointer-events: none;
}
.btn.is-muted {
  opacity: .5;
}
/* 刚写入的记录闪一下 */
@keyframes flashNew {
  0%   { background: rgba(47, 191, 136, .28); }
  100% { background: transparent; }
}

.rec.is-new,
.history > *:first-child.is-new {
  animation: flashNew 1.6s ease-out;
  border-radius: 12px;
}
/* ==========================================================
   记录条目的就地编辑
   ========================================================== */

.rec {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.rec.is-skip { opacity: .55; }
.rec.is-done .rec-name { color: var(--accent-ink); }

.rec-body { flex: 1; min-width: 0; }

.rec-badge {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 500;
  vertical-align: middle;
}

.rec-badge.ok { background: var(--accent-soft); color: var(--accent-ink); }
.rec-badge.no { background: var(--field); color: var(--muted); }

.rec-fields {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}

.rec-field {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  padding: 5px 7px;
  border-radius: 9px;
  background: var(--field);
}

.rec-field-k {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.rec-field-u {
  font-size: 11px;
  color: var(--muted);
}

.rec-input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 0;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.rec-input::-webkit-outer-spin-button,
.rec-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.rec-acts {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.rec-acts .mark {
  width: 34px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.rec-acts .mark-ok.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.rec-acts .mark-no.on {
  background: #fdecec;
  border-color: #f3c2c2;
  color: #b91c1c;
}

.rec-add-row {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}