/* ============ 基础 ============ */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #14161a;
  --ink-2: #5b6270;
  --ink-3: #9aa1ad;
  --line: #eceef2;
  --line-2: #e3e6ec;

  --push: #3b82f6;
  --push-soft: #e8f1ff;
  --pull: #8b5cf6;
  --pull-soft: #f0ebff;
  --legs: #16a34a;
  --legs-soft: #e6f6ec;

  --accent: var(--push);
  --accent-soft: var(--push-soft);

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-up: 0 -8px 30px rgba(16, 24, 40, .08);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(84px + var(--safe-b));
  min-height: 100vh;
}
body.has-rest #app { padding-bottom: calc(168px + var(--safe-b)); }
.view.hidden { display: none; }

/* ============ 顶部 ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -16px;
  padding: 14px 16px 10px;
  background: linear-gradient(180deg, var(--bg) 72%, rgba(244, 245, 247, 0));
}
.topbar-row { display: flex; align-items: center; gap: 10px; }
.topbar-title { min-width: 0; flex: 1; }
.topbar h1 {
  font-size: 21px; font-weight: 700; margin: 0; letter-spacing: -.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .sub { color: var(--ink-3); font-size: 12.5px; margin: 1px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.date-btn, .ghost-btn { white-space: nowrap; flex: 0 0 auto; }
.date-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line-2);
  color: var(--ink-2); font-size: 13px;
}
.date-btn svg { width: 15px; height: 15px; }
.date-btn input {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.ghost-btn {
  height: 34px; padding: 0 12px; border-radius: 999px;
  color: var(--ink-2); font-size: 13px; background: #fff; border: 1px solid var(--line-2);
  display: inline-flex; align-items: center; gap: 6px;
}

/* ============ 分化选择 ============ */
.split-row { display: flex; gap: 8px; margin: 12px 0 6px; }
.split {
  flex: 1; position: relative; overflow: hidden;
  padding: 11px 10px 12px; border-radius: 16px;
  background: #fff; border: 1.5px solid transparent;
  box-shadow: var(--shadow);
  text-align: left; transition: transform .12s ease, border-color .16s ease;
}
.split:active { transform: scale(.98); }
.split b { display: block; font-size: 17px; letter-spacing: .5px; }
.split small { display: block; color: var(--ink-3); font-size: 11px; margin-top: 2px; line-height: 1.3; }
.split .dot { position: absolute; right: 10px; top: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.split[data-split="push"] b { color: var(--push); }
.split[data-split="pull"] b { color: var(--pull); }
.split[data-split="legs"] b { color: var(--legs); }
.split.on { border-color: currentColor; }
.split.on[data-split="push"] { background: var(--push-soft); border-color: rgba(59,130,246,.45); }
.split.on[data-split="pull"] { background: var(--pull-soft); border-color: rgba(139,92,246,.45); }
.split.on[data-split="legs"] { background: var(--legs-soft); border-color: rgba(22,163,74,.45); }
.split.on .dot { background: currentColor; }

.session-note {
  margin: 10px 2px 0; color: var(--ink-3); font-size: 12.5px;
  display: flex; align-items: center; gap: 6px;
}
.session-note b { color: var(--ink-2); font-weight: 600; }

/* ============ 卡片 / 动作行 ============ */
.group-title {
  margin: 20px 2px 8px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  display: flex; align-items: center; gap: 8px;
}
.group-title::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}

.ex {
  display: block; width: 100%; text-align: left;
  padding: 13px 14px 13px 12px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.ex:last-child { border-bottom: 0; }
.ex:active { background: #fafbfc; }
.ex-top { display: flex; align-items: center; gap: 9px; }
.ex-idx {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 7px;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 600;
  color: var(--ink-3); background: #f3f4f7;
}
.ex.done .ex-idx { background: var(--accent-soft); color: var(--accent); }
.ex-name { font-size: 15.5px; font-weight: 600; letter-spacing: .1px; }
.ex-tag {
  font-size: 10.5px; padding: 1px 5px; border-radius: 5px;
  color: #b45309; background: #fdf1dc; font-weight: 500; transform: translateY(-1px);
}
.ex-target { margin-left: auto; color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ex-stats { display: flex; align-items: center; gap: 6px; margin: 8px 0 0 31px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: baseline; gap: 3px;
  padding: 3px 8px; border-radius: 8px; background: #f5f6f8;
  font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--ink-2);
}
.pill b { font-size: 13.5px; font-weight: 650; color: var(--ink); }
.pill .u { font-size: 10.5px; color: var(--ink-3); }
.pill.empty { color: var(--ink-3); background: transparent; border: 1px dashed var(--line-2); }
.pill.ghost { background: transparent; padding: 3px 2px; }
.ex-last { margin: 7px 0 0 31px; color: var(--ink-3); font-size: 11.5px; }
.ex-last b { color: var(--ink-2); font-weight: 600; }
.ex-check {
  position: absolute; right: 12px; bottom: 12px; width: 20px; height: 20px;
  color: var(--accent); opacity: 0; transition: opacity .2s;
}
.ex.done .ex-check { opacity: 1; }
.ex-check svg { width: 20px; height: 20px; }

/* ============ 汇总条 ============ */
.summary {
  display: flex; gap: 10px; margin-top: 12px;
  padding: 14px 16px; border-radius: var(--radius);
  background: linear-gradient(135deg, #fff, #fbfcfe);
  box-shadow: var(--shadow); border: 1px solid #fff;
}
.summary .item { flex: 1; }
.summary .item + .item { border-left: 1px solid var(--line); padding-left: 12px; }
.summary .k { font-size: 11px; color: var(--ink-3); }
.summary .v { font-size: 19px; font-weight: 680; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.summary .v span { font-size: 11px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }

.hint {
  margin: 14px 2px 0; padding: 12px 14px; border-radius: 14px;
  background: #fff; color: var(--ink-2); font-size: 12.5px; line-height: 1.6;
  box-shadow: var(--shadow);
}
.hint b { color: var(--ink); }

/* ============ 底部标签栏 ============ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center; gap: 6px;
  padding: 8px 12px calc(8px + var(--safe-b));
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 0 3px; border-radius: 12px; color: var(--ink-3); font-size: 11px;
  transition: color .16s;
}
.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--ink); }
.tab.active svg { stroke-width: 2.1; }

/* ============ 动作详情 ============ */
.sheet {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(16, 24, 40, .28);
  opacity: 0; pointer-events: none; transition: opacity .22s ease;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet.open { opacity: 1; pointer-events: auto; }
.sheet-panel {
  width: 100%; max-width: 560px; height: auto; max-height: 92vh;
  background: var(--bg); border-radius: 26px 26px 0 0;
  transform: translateY(24px); transition: transform .26s cubic-bezier(.32,.72,0,1);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-up);
}
.sheet.open .sheet-panel { transform: translateY(0); }
.sheet-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 10px; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.sheet-title h2 { margin: 0; font-size: 18px; font-weight: 680; letter-spacing: -.2px; }
.sheet-title p { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }
.sheet-head .spacer { flex: 1; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: #eef0f4; color: var(--ink-2); flex: 0 0 32px;
}
.icon-btn svg { width: 17px; height: 17px; }
.sheet-body {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px 14px calc(28px + var(--safe-b));
}

/* ============ 滑轮 ============ */
.wheels {
  display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 6px;
  background: #fff; border-radius: var(--radius); padding: 10px 6px 8px;
  box-shadow: var(--shadow);
}
.wheel { position: relative; }
.wheel-label {
  text-align: center; font-size: 11px; color: var(--ink-3); margin-bottom: 2px; height: 15px;
}
.wheel-viewport {
  position: relative; height: 160px; overflow: hidden;
  mask-image: linear-gradient(180deg, transparent, #000 24%, #000 76%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 24%, #000 76%, transparent);
}
.wheel-band {
  position: absolute; left: 4px; right: 4px; top: 50%; height: 32px; margin-top: -16px;
  border-radius: 8px; background: #f4f6fa; pointer-events: none;
}
.wheel-scroll {
  position: relative; height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory;
  scrollbar-width: none; -ms-overflow-style: none; z-index: 1;
  touch-action: pan-y;
}
.wheel-scroll::-webkit-scrollbar { display: none; }
.wheel-item {
  height: 32px; display: flex; align-items: center; justify-content: center;
  scroll-snap-align: center; font-size: 15px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; transition: color .12s, opacity .12s;
  will-change: transform, opacity;
}
.wheel-item.active { color: var(--ink); font-weight: 680; }
.wheel-pad { height: 64px; }
.wheel-unit {
  text-align: center; font-size: 10px; color: var(--ink-3); margin-top: 2px; height: 13px;
}

.last-line {
  display: flex; align-items: center; gap: 6px; margin: 12px 2px 0;
  font-size: 12.5px; color: var(--ink-3);
}
.last-line b { color: var(--ink-2); }

/* ============ 组 ============ */
.set-list { margin-top: 14px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.set-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.set-row:last-child { border-bottom: 0; }
.set-no {
  width: 44px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.set-row.done .set-no { color: var(--accent); font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 2px; background: #f5f6f8; border-radius: 10px; padding: 2px; }
.stepper button {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  color: var(--ink-2); font-size: 17px; line-height: 1;
}
.stepper button:active { background: #e9ecf1; }
.stepper .val {
  min-width: 40px; text-align: center; font-size: 14.5px; font-weight: 620;
  font-variant-numeric: tabular-nums;
}
.stepper .val small { font-size: 10px; font-weight: 500; color: var(--ink-3); margin-left: 1px; }
.set-x { color: var(--ink-3); font-size: 12px; }
.set-check {
  margin-left: auto; width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid var(--line-2); display: grid; place-items: center; color: transparent;
  transition: all .16s ease;
}
.set-check svg { width: 15px; height: 15px; stroke-width: 2.6; }
.set-row.done .set-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.set-row.done .stepper { opacity: .55; }

.note-input {
  width: 100%; margin-top: 14px; padding: 12px 14px; border-radius: 14px;
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: 13.5px; resize: none; outline: none;
}
.note-input:focus { border-color: #cfd6e2; }

/* ============ 休息倒计时 ============ */
.rest-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(78px + var(--safe-b)); z-index: 70;
  width: min(528px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 16px;
  background: #101828; color: #fff; box-shadow: 0 12px 30px rgba(16,24,40,.28);
}
.rest-bar.hidden { display: none; }
.rest-bar .t { font-size: 18px; font-weight: 680; font-variant-numeric: tabular-nums; letter-spacing: .5px; min-width: 56px; }
.rest-bar .k { font-size: 11px; opacity: .66; }
.rest-bar .track { flex: 1; height: 5px; border-radius: 4px; background: rgba(255,255,255,.2); overflow: hidden; }
.rest-bar .fill { height: 100%; background: #7ee2a8; transition: width .9s linear; }
.rest-bar button { color: #fff; font-size: 12px; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.16); }
.rest-bar.done { background: #0f7a3d; }

/* ============ 趋势页 ============ */
.page-title { font-size: 22px; font-weight: 700; margin: 18px 0 2px; letter-spacing: -.3px; }
.page-sub { color: var(--ink-3); font-size: 12.5px; margin: 0 0 14px; }

.seg {
  display: flex; gap: 3px; padding: 3px; border-radius: 12px;
  background: #eaecf0; margin-bottom: 12px;
}
.seg button {
  flex: 1; padding: 7px 4px; border-radius: 9px; font-size: 12.5px; color: var(--ink-2);
  transition: all .16s;
}
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(16,24,40,.1); }

.chart-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 10px 8px; }
.chart-head { display: flex; align-items: baseline; gap: 8px; padding: 0 6px 6px; }
.chart-head .t { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.chart-head .v { margin-left: auto; font-size: 20px; font-weight: 700; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.chart-head .v small { font-size: 11px; color: var(--ink-3); font-weight: 500; margin-left: 3px; }
canvas.chart { width: 100%; height: 176px; display: block; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.kpi { background: #fff; border-radius: 14px; padding: 10px 8px; text-align: center; box-shadow: var(--shadow); }
.kpi .v { font-size: 17px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 10px; color: var(--ink-3); font-weight: 500; }
.kpi .k { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }

.ex-picker { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; margin-top: 12px; scrollbar-width: none; }
.ex-picker::-webkit-scrollbar { display: none; }
.ex-picker button {
  white-space: nowrap; padding: 7px 11px; border-radius: 999px; font-size: 12.5px;
  background: #fff; color: var(--ink-2); border: 1px solid var(--line-2);
}
.ex-picker button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.section-title { margin: 22px 2px 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }

.hist-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fff;
}
.hist-item:last-child { border-bottom: 0; }
.hist-item .badge {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.badge.push { background: var(--push-soft); color: var(--push); }
.badge.pull { background: var(--pull-soft); color: var(--pull); }
.badge.legs { background: var(--legs-soft); color: var(--legs); }
.hist-item .d { display: block; font-size: 13.5px; font-weight: 600; }
.hist-item .m { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.hist-item .r { margin-left: auto; text-align: right; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.hist-item .r b { font-size: 14px; color: var(--ink); font-weight: 650; margin-right: 1px; }

/* ============ 数据页 ============ */
.btn-row { display: grid; gap: 10px; margin-top: 12px; }
.btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 14px 16px; border-radius: 14px; background: #fff;
  box-shadow: var(--shadow); font-size: 14px; text-align: left;
}
.btn .chev { color: var(--ink-3); }
.btn.danger { color: #c0392b; }
.btn small { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 1px; }

/* ============ 计划表 ============ */
.plan-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 12px; }
.plan-card header { padding: 12px 14px; }
.plan-card header b { font-size: 16px; display: block; }
.plan-card header small { color: var(--ink-3); font-size: 11.5px; }
.plan-card.push header { background: var(--push-soft); }
.plan-card.pull header { background: var(--pull-soft); }
.plan-card.legs header { background: var(--legs-soft); }
.plan-group { padding: 8px 14px 2px; font-size: 12px; color: var(--ink-3); }
.plan-row { display: flex; align-items: baseline; gap: 8px; padding: 5px 14px; font-size: 13.5px; }
.plan-row .n { color: var(--ink-3); width: 14px; font-size: 11.5px; }
.plan-row .s { margin-left: auto; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.plan-row .t { font-size: 10px; color: #b45309; background: #fdf1dc; border-radius: 4px; padding: 0 4px; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 10px);
  background: rgba(16,24,40,.92); color: #fff; font-size: 13px;
  padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 80; max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.empty-state { text-align: center; color: var(--ink-3); font-size: 13px; padding: 26px 10px; }

/* ============ 历史 ============ */
.month-title {
  margin: 18px 2px 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  display: flex; align-items: baseline; gap: 6px;
}
.month-title span { font-weight: 400; color: var(--ink-3); font-size: 11px; }
.hist-item .chev { margin-left: auto; color: var(--ink-3); font-size: 18px; line-height: 1; }
.hist-item .r { display: none; }

/* 上次对比 */
.last-tag {
  display: inline-block; padding: 1px 5px; border-radius: 5px;
  background: #f1f3f7; color: var(--ink-3); font-size: 10.5px; margin-right: 2px;
}
.delta {
  display: inline-block; padding: 1px 6px; border-radius: 6px;
  font-size: 10.5px; font-weight: 600; margin-left: 4px; font-variant-numeric: tabular-nums;
}
.delta.up { color: #0f7a3d; background: #e7f6ec; }
.delta.down { color: #b42318; background: #fdeceb; }
.delta.same { color: var(--ink-3); background: #f2f4f7; }

/* 动作历史 */
.ex-hist-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.ex-hist-row:last-child { border-bottom: 0; }
.ex-hist-row .d { color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 44px; }
.ex-hist-row .d i {
  font-style: normal; margin-left: 4px; font-size: 10px; color: var(--ink-3);
  background: #f2f4f7; border-radius: 4px; padding: 0 3px;
}
.ex-hist-row .v { color: var(--ink-2); }
.ex-hist-row .v b { color: var(--ink); font-weight: 650; }
.ex-hist-row .vol { margin-left: auto; color: var(--ink-3); font-size: 11px; }

/* 单次训练详情 */
.sess-ex { padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.sess-ex:last-child { border-bottom: 0; }
.sess-ex:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.sess-ex-head { display: flex; align-items: center; gap: 6px; }
.sess-ex-head .n { font-size: 14.5px; font-weight: 620; }
.sess-ex-head .r { margin-left: auto; color: var(--ink-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.sess-sets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.schip {
  font-size: 12px; padding: 3px 8px; border-radius: 7px;
  background: #f2f4f7; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.schip.on { background: var(--accent-soft); color: #1b4fa8; }
.sess-prev { margin-top: 6px; font-size: 11.5px; color: var(--ink-3); }
#session-body .card, #session-body > .sess-ex { }
#session-body { background: transparent; }
#session-body > .sess-ex { background: #fff; }
#session-body > .sess-ex:nth-child(1) { border-radius: var(--radius) var(--radius) 0 0; }
#session-body > .hint { margin-top: 12px; }

/* ============ 体重 ============ */
.weight-stats { display: flex; gap: 12px; padding: 0 8px 6px; font-size: 11.5px; color: var(--ink-3); }
.weight-stats b { color: var(--ink-2); font-weight: 600; }
.weight-stats b.up { color: #b42318; }
.weight-stats b.down { color: #0f7a3d; }
.inline-btn {
  margin: 6px 6px 8px; padding: 10px 12px; border-radius: 12px;
  background: #f5f6f8; color: var(--ink); font-size: 13px; width: calc(100% - 12px);
  transition: background .16s;
}
.inline-btn:active { background: #eceff4; }

.weight-edit {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  background: #fff; border-radius: var(--radius); padding: 22px 16px; box-shadow: var(--shadow);
}
.weight-edit > button {
  width: 44px; height: 44px; border-radius: 14px; background: #f2f4f7;
  font-size: 22px; line-height: 1; color: var(--ink-2); display: grid; place-items: center;
}
.weight-edit > button:active { background: #e7ebf1; }
.w-input-wrap { display: flex; align-items: baseline; gap: 4px; }
.w-input-wrap input {
  width: 128px; text-align: right; border: 0; background: transparent; outline: none;
  font-size: 40px; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums;
}
.w-input-wrap span { font-size: 14px; color: var(--ink-3); }
.btn.primary {
  justify-content: center; margin-top: 12px; background: #101828; color: #fff;
  box-shadow: 0 10px 24px rgba(16,24,40,.18);
}

/* 四标签布局 */
.tabbar .tab { max-width: 120px; }
.tab { font-size: 10.5px; gap: 2px; }
.tab svg { width: 20px; height: 20px; }

/* ============ 日历 ============ */
.cal-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 10px 8px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; }
.cal-title { font-size: 14.5px; font-weight: 650; letter-spacing: -.2px; }
.cal-nav {
  width: 32px; height: 32px; border-radius: 10px; background: #f2f4f7;
  color: var(--ink-2); font-size: 18px; line-height: 1; display: grid; place-items: center;
}
.cal-nav:active { background: #e7ebf1; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; color: var(--ink-3); padding-bottom: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day {
  position: relative; aspect-ratio: 1 / 1; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.cal-day.blank { visibility: hidden; }
.cal-day.has { background: #eaf1fd; color: var(--ink); font-weight: 600; }
.cal-day.today { box-shadow: inset 0 0 0 1.5px #101828; }
.cal-day:active { background: #eaeef6; }
.cal-day .dots { display: flex; gap: 2px; height: 6px; align-items: center; }
.cdot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.cdot.push { background: var(--push); }
.cdot.pull { background: var(--pull); }
.cdot.legs { background: var(--legs); }
.cal-legend { display: flex; align-items: center; gap: 10px; padding: 10px 6px 2px; font-size: 11px; color: var(--ink-3); }
.cal-legend .cdot { margin-right: 3px; vertical-align: middle; }
.cal-legend b { color: var(--ink); }
.cal-legend .spacer { flex: 1; }

.seg-mini { margin: 2px 0 8px; }
.seg-mini button { font-size: 12px; padding: 6px 4px; }
.pdot { width: 4px; height: 4px; border-radius: 50%; background: #2f6fe4; display: inline-block; margin-left: 4px; vertical-align: middle; }
.cal-day.today { box-shadow: inset 0 0 0 1.5px #1f2a3d; }
.cal-day.today .n { color: #1b4fa8; }

/* ============ 自定义日 ============ */
.split-row.four { gap: 6px; }
.split-row.four .split { padding: 10px 8px 11px; min-width: 0; }
.split-row.four .split b { font-size: 16px; }
.split-row.four .split.custom b { font-size: 13.5px; letter-spacing: 0; white-space: nowrap; }
.split-row.four .split small {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 10px; line-height: 1.25;
}
.badge.custom { background: #eef0f4; color: #475467; font-size: 11px; }

.custom-head { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-top: 4px; }
.ch-label { display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 6px; }
.custom-input {
  width: 100%; border: 0; background: #f5f6f8; border-radius: 10px;
  padding: 10px 12px; font-size: 15px; outline: none;
}
.custom-input:focus { box-shadow: inset 0 0 0 1.5px #cfd8e6; }
.quick-chips { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.quick-chips button { padding: 5px 11px; border-radius: 999px; background: #f2f4f7; color: var(--ink-2); font-size: 12px; }
.quick-chips button.on { background: #101828; color: #fff; }
.add-ex {
  width: 100%; padding: 13px; color: #2f6fe4; font-size: 13.5px;
  background: #fff; border-top: 1px solid var(--line); font-weight: 600;
}
.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input {
  flex: 1; min-width: 0; padding: 11px 12px; border-radius: 12px;
  border: 1px solid var(--line-2); background: #fff; font-size: 14px; outline: none;
}
.add-row button { padding: 0 16px; border-radius: 12px; background: #101828; color: #fff; font-size: 13px; }
.add-row.hidden { display: none; }

.ctags { display: flex; gap: 2px; align-items: center; }
.ctag {
  font-style: normal; font-size: 9px; line-height: 1; padding: 2px 3px;
  border-radius: 4px; background: #eef1f6; color: #374151; font-weight: 600;
}
.icon-btn.danger { color: #b42318; background: #fdeceb; }
.icon-btn.danger:hover { background: #fbdcd9; }

/* 自定义分化卡：选中态用中性色 */
.split[data-split="custom"] b { color: var(--ink); }
.split.on[data-split="custom"] { background: #f3f4f7; border-color: rgba(16, 24, 40, .35); }
.split.on[data-split="custom"] .dot { background: var(--ink); }

/* ============ 当天主题 ============ */
.theme-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-opt {
  text-align: left; padding: 12px 14px; border-radius: 14px; background: #fff;
  border: 1.5px solid transparent; box-shadow: var(--shadow);
}
.theme-opt:active { background: #f7f8fa; }
.theme-opt b { display: block; font-size: 15px; letter-spacing: .2px; }
.theme-opt small { display: block; color: var(--ink-3); font-size: 11px; margin-top: 3px; }
.theme-opt.on { border-color: #101828; background: #f4f6fa; }
#theme-custom-wrap { margin-top: 12px; }
#theme-custom-wrap.hidden { display: none; }
.theme-actions { display: grid; gap: 10px; margin-top: 16px; }

/* ============ 保存动作 ============ */
.sheet-actions {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px calc(10px + var(--safe-b));
  background: #fff; border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(16, 24, 40, .05);
}
.dirty-hint {
  font-size: 11px; color: #b45309; background: #fdf1dc;
  padding: 3px 8px; border-radius: 999px; opacity: 0; transform: scale(.9);
  transition: opacity .18s, transform .18s;
}
.dirty-hint.on { opacity: 1; transform: scale(1); }
.act-cancel {
  height: 46px; padding: 0 18px; border-radius: 14px;
  background: #f2f4f7; color: var(--ink-2); font-size: 14.5px;
}
.act-cancel:active { background: #e7ebf1; }
.act-save {
  flex: 1; height: 46px; border-radius: 14px;
  background: #101828; color: #fff; font-size: 15.5px; font-weight: 650; letter-spacing: .5px;
  transition: background .18s, transform .1s;
}
.act-save:active { transform: scale(.985); }
.act-save.saved { background: #0f7a3d; }
.act-save:disabled { opacity: 1; }

.save-hint {
  margin: 10px 4px 0; font-size: 11.5px; color: var(--ink-3); text-align: center;
}
.save-hint b { color: var(--ink-2); }

@keyframes rowFlash {
  0% { background: #fff3e4; }
  60% { background: #fff8f0; }
  100% { background: #fff; }
}
.ex.flash { animation: rowFlash 1.6s ease-out; }

/* 有休息倒计时时，toast 往上挪，避免两个浮层叠在一起 */
body.has-rest .toast { bottom: calc(170px + var(--safe-b)); }
