/* ============================================================
   健身工作台 · 界面样式
   手机优先，宽屏切换为侧边栏布局
   ============================================================ */

:root {
  --bg: #f1f3ee;
  --bg-2: #e9ede3;
  --surface: #ffffff;
  --surface-2: #f6f8f3;
  --surface-3: #edf1e9;
  --ink: #111a15;
  --ink-2: #44534a;
  --ink-3: #7b8a80;
  --line: rgba(17, 35, 24, 0.09);
  --line-2: rgba(17, 35, 24, 0.16);
  --accent: #12905f;
  --accent-2: #0b6e49;
  --accent-soft: #e4f6ec;
  --lime: #d9f982;
  --lime-soft: #f1fbcf;
  --danger: #cf4b45;
  --danger-soft: #fbeae9;
  --topbar-bg: rgba(241, 243, 238, 0.8);
  --tabbar-bg: rgba(252, 253, 250, 0.86);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.75) inset, 0 10px 30px -26px rgba(13, 40, 25, 0.55);
  --shadow-float: 0 30px 70px -28px rgba(9, 30, 18, 0.5);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-num: ui-rounded, -apple-system, "SF Pro Rounded", "PingFang SC", system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

html[data-theme="dark"] {
  --bg: #0b100d;
  --bg-2: #111815;
  --surface: #141c17;
  --surface-2: #18221c;
  --surface-3: #1e2a22;
  --ink: #eef5ef;
  --ink-2: #b3c1b7;
  --ink-3: #7f9187;
  --line: rgba(215, 255, 231, 0.09);
  --line-2: rgba(215, 255, 231, 0.18);
  --accent: #35d497;
  --accent-2: #6ee7b0;
  --accent-soft: rgba(53, 212, 151, 0.13);
  --lime: #d9f982;
  --lime-soft: rgba(217, 249, 130, 0.13);
  --danger: #ff7b72;
  --danger-soft: rgba(255, 123, 114, 0.13);
  --topbar-bg: rgba(11, 16, 13, 0.76);
  --tabbar-bg: rgba(15, 22, 18, 0.86);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 16px 40px -32px rgba(0, 0, 0, 0.8);
  --shadow-float: 0 32px 80px -24px rgba(0, 0, 0, 0.75);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
}

a {
  touch-action: manipulation;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

h1, h2, h3, h4, p {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

svg {
  display: block;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: var(--lime);
  color: #12210f;
}

/* ---------------------------------------------------------- 布局骨架 */

.app {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  display: none;
}

.shell {
  flex: 1;
  min-width: 0;
  padding-bottom: calc(74px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: calc(56px + var(--safe-top));
  padding: var(--safe-top) 14px 0;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px solid transparent;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  color: #d9f982;
  background: linear-gradient(145deg, #0d2118, #17412f 70%);
  box-shadow: 0 8px 18px -10px rgba(10, 45, 28, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  flex: none;
}

.brand-mark-sm {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--ink-2);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.icon-btn:active {
  transform: scale(0.94);
}

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3fca8a;
  box-shadow: 0 0 0 3px rgba(63, 202, 138, 0.14);
  flex: none;
}

.sync-chip.is-saving .sync-dot,
.server-chip.is-saving .sync-dot {
  background: #e4b24b;
  box-shadow: 0 0 0 3px rgba(228, 178, 75, 0.16);
  animation: pulse 1s ease infinite;
}

.sync-chip.is-error .sync-dot,
.server-chip.is-error .sync-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(207, 75, 69, 0.16);
}

@keyframes pulse {
  50% { opacity: 0.45; }
}

.view {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 6px 14px 34px;
}

.page {
  animation: page-in 0.34s cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------- 启动 / 空状态 */

.boot {
  min-height: 58vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--ink-3);
  font-size: 13.5px;
}

.boot-mark {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 22px;
  color: #d9f982;
  background: linear-gradient(145deg, #0c1d15, #16412e);
  animation: breathe 2.4s ease-in-out infinite;
  box-shadow: 0 20px 50px -24px rgba(10, 45, 28, 0.9);
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.boot-error {
  max-width: 420px;
  margin: 12vh auto 0;
  text-align: center;
  padding: 0 8px;
}

.boot-error .err-mark {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 auto 18px;
  border-radius: 20px;
  background: var(--danger-soft);
  color: var(--danger);
}

.boot-error h1 {
  font-size: 20px;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.boot-error p {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.7;
}

.boot-error code {
  display: inline-block;
  margin-top: 10px;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--surface-3);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  color: var(--ink);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 44px 18px;
  text-align: center;
  color: var(--ink-3);
}

.empty-art {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 24px;
  margin-bottom: 6px;
  color: var(--accent);
  background: var(--accent-soft);
}

.empty h3 {
  color: var(--ink);
  font-size: 16.5px;
  letter-spacing: -0.01em;
}

.empty p {
  font-size: 13px;
  line-height: 1.7;
  max-width: 280px;
}

.empty .btn {
  margin-top: 12px;
}

/* ---------------------------------------------------------- 页头 / 按钮 */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 2px 16px;
}

.page-head h1 {
  font-size: 26px;
  letter-spacing: -0.035em;
  line-height: 1.18;
  font-weight: 760;
}

.page-head p {
  margin-top: 5px;
  color: var(--ink-3);
  font-size: 13px;
}

.page-head .head-actions {
  display: flex;
  gap: 8px;
  flex: none;
  padding-bottom: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  padding: 0 17px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 660;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  transition: transform 0.16s ease, background 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn svg {
  flex: none;
  width: 17px;
  height: 17px;
}

.btn-primary {
  background: linear-gradient(180deg, #17a870, #0e8659);
  color: #fff;
  box-shadow: 0 12px 24px -14px rgba(14, 134, 89, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #18b477, #0e8e5e);
}

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent-2);
  border-color: transparent;
}

.btn-soft:hover {
  background: var(--surface-3);
}

.btn-outline {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--ink-2);
}

.btn-outline:hover {
  background: var(--surface-2);
}

.btn-lime {
  background: linear-gradient(180deg, #e3ff9d, #c9ef6b);
  color: #172711;
  box-shadow: 0 14px 28px -16px rgba(201, 239, 107, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.17);
  color: #eafff4;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.16);
}

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

.btn-wide {
  width: 100%;
}

.btn-sm {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12.5px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent-2);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------- Hero */

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  border-radius: var(--radius-xl);
  color: #f2fff8;
  background: linear-gradient(138deg, #0a1a13 0%, #123225 55%, #0c261b 100%);
  box-shadow: 0 30px 60px -34px rgba(7, 35, 22, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 110% at 88% 4%, rgba(217, 249, 130, 0.3), transparent 58%),
    radial-gradient(60% 90% at 0% 100%, rgba(26, 179, 116, 0.34), transparent 60%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -70px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.hero-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
}

.hero-kicker {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: rgba(226, 255, 240, 0.66);
}

.hero-title {
  margin-top: 6px;
  font-size: clamp(22px, 6.4vw, 30px);
  font-weight: 780;
  letter-spacing: -0.035em;
  line-height: 1.16;
  color: #f6fff9;
}

.hero-sub {
  margin-top: 7px;
  font-size: 12.5px;
  color: rgba(219, 250, 233, 0.72);
  line-height: 1.5;
  max-width: 30ch;
}

.hero-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.hero-actions .btn {
  height: 40px;
  font-size: 13.5px;
  padding: 0 15px;
}

.hero-ring {
  position: relative;
  z-index: 1;
  flex: none;
  width: 104px;
  height: 104px;
  align-self: center;
}

.hero-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.ring-center strong {
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 760;
  letter-spacing: -0.03em;
  color: #f4fff8;
}

.ring-center span {
  font-size: 10px;
  font-weight: 600;
  color: rgba(219, 250, 233, 0.6);
  letter-spacing: 0.06em;
}

/* ---------------------------------------------------------- 统计小卡 */

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 12px 12px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.stat-value {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--font-num);
  font-size: 21px;
  font-weight: 760;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-unit {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0;
}

.stat-label {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------- 卡片 */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 17px 16px;
  box-shadow: var(--shadow-card);
}

.card + .card {
  margin-top: 10px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-head h2 {
  font-size: 16.5px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.card-head p {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-3);
}

.card-head .head-aside {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding-top: 1px;
}

.card-title {
  font-size: 16.5px;
  font-weight: 720;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.today-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  align-items: start;
}

/* ---------------------------------------------------------- 今日 · 计划卡 */

.ex-list {
  display: flex;
  flex-direction: column;
}

.ex-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}

.ex-row:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.ex-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c, var(--accent));
  flex: none;
  opacity: 0.85;
}

.ex-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ex-target {
  flex: none;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.rest-state {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0 14px;
}

.rest-state .rest-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 14px;
  background: var(--lime-soft);
  color: #5c7a1e;
}

html[data-theme="dark"] .rest-state .rest-icon {
  color: var(--lime);
}

.rest-state strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
}

.rest-state span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-3);
}

.plan-card .btn-wide {
  margin-top: 14px;
}

/* ---------------------------------------------------------- 今日 · 体重卡 */

.weigh-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.weigh-value {
  font-family: var(--font-num);
  font-size: 30px;
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.weigh-value small {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0;
  margin-left: 3px;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  background: var(--surface-3);
  color: var(--ink-2);
}

.delta.down {
  background: var(--accent-soft);
  color: var(--accent-2);
}

.delta.up {
  background: #fdf1e5;
  color: #a9661f;
}

html[data-theme="dark"] .delta.up {
  background: rgba(228, 178, 75, 0.13);
  color: #e4b24b;
}

.spark {
  margin: 10px -2px 4px;
  height: 46px;
}

.spark svg {
  width: 100%;
  height: 100%;
}

.weigh-form {
  display: flex;
  gap: 7px;
  margin-top: 12px;
}

.quick-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border 0.18s ease, background 0.18s ease;
}

.quick-input::placeholder {
  font-size: 13px;
  color: var(--ink-3);
}

.quick-input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.quick-btn {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 19px;
  font-weight: 500;
  transition: transform 0.16s ease, background 0.2s ease;
}

.quick-btn:active {
  transform: scale(0.94);
}

.weigh-hint {
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--ink-3);
}

/* ---------------------------------------------------------- 今日 · 最近 */

.recent-list {
  display: flex;
  flex-direction: column;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.recent-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.recent-item:first-child {
  padding-top: 0;
}

.ri-date {
  flex: none;
  width: 40px;
  text-align: center;
}

.ri-date strong {
  display: block;
  font-family: var(--font-num);
  font-size: 17px;
  font-weight: 740;
  line-height: 1;
  letter-spacing: -0.02em;
}

.ri-date span {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: var(--ink-3);
}

.ri-main {
  flex: 1;
  min-width: 0;
}

.ri-main h4 {
  font-size: 13.5px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ri-main p {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ri-meta {
  flex: none;
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tip-card {
  position: relative;
  overflow: hidden;
  margin-top: 10px;
  display: flex;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--lime-soft), var(--surface));
  border: 1px solid var(--line);
}

html[data-theme="dark"] .tip-card {
  background: linear-gradient(135deg, rgba(217, 249, 130, 0.09), var(--surface));
}

.tip-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--lime);
  color: #34460d;
}

.tip-body h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tip-body p {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}

/* ---------------------------------------------------------- 训练列表 */

.summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 0 2px 14px;
  font-size: 12px;
  color: var(--ink-3);
}

.summary-line b {
  color: var(--ink);
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.month-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 2px 8px;
  font-size: 12px;
  font-weight: 680;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.month-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.workout-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workout-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.workout-item:active {
  transform: scale(0.994);
}

.workout-item:hover {
  border-color: var(--line-2);
}

.wi-date {
  flex: none;
  width: 44px;
  height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.wi-date strong {
  font-family: var(--font-num);
  font-size: 18px;
  font-weight: 740;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.wi-date span {
  font-size: 9.5px;
  color: var(--ink-3);
}

.wi-main {
  flex: 1;
  min-width: 0;
}

.wi-title {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wi-sub {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wi-meta {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.wi-meta b {
  font-size: 12.5px;
  font-weight: 680;
  color: var(--ink);
}

.chev {
  flex: none;
  color: var(--ink-3);
  opacity: 0.6;
}

/* ---------------------------------------------------------- 训练详情 */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 14px 0 4px;
  font-size: 12.5px;
  font-weight: 620;
  color: var(--ink-3);
}

.back-link:hover {
  color: var(--ink);
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 16px;
}

.detail-kicker {
  font-size: 12px;
  font-weight: 650;
  color: var(--accent-2);
  letter-spacing: 0.01em;
}

.detail-title {
  margin-top: 4px;
  font-size: 25px;
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.detail-sub {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.detail-actions {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.ex-block {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.ex-block + .ex-block {
  margin-top: 8px;
}

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

.ex-block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 680;
  letter-spacing: -0.01em;
  min-width: 0;
}

.ex-block-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ex-block-vol {
  flex: none;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.sets-table {
  border-top: 1px solid var(--line);
}

.set-line {
  display: grid;
  grid-template-columns: 22px 1fr 1fr 64px;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.set-line:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.set-idx {
  font-size: 10.5px;
  font-weight: 650;
  color: var(--ink-3);
}

.set-val {
  font-weight: 600;
}

.set-val em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 500;
  margin-left: 2px;
}

.set-vol {
  text-align: right;
  color: var(--ink-3);
  font-size: 11.5px;
}

.note-box {
  margin-top: 12px;
  padding: 13px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-2);
  white-space: pre-wrap;
}

/* ---------------------------------------------------------- 数据 / 图表 */

.chart {
  margin: 4px -4px 2px;
}

.chart svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-label {
  fill: var(--ink-3);
  font-size: 10.5px;
  font-weight: 550;
  font-family: var(--font);
}

.chart-value {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-num);
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2.4;
}

.chart-bar {
  fill: var(--accent-soft);
  transition: fill 0.2s ease;
}

.chart-bar.now {
  fill: var(--accent);
}

.chart-bar-label {
  fill: var(--ink-3);
  font-size: 9.5px;
  font-family: var(--font);
}

.measure-list {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

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

.measure-row:last-child {
  border-bottom: 0;
}

.measure-date {
  flex: none;
  width: 74px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
}

.measure-open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  text-align: left;
  color: inherit;
}

.measure-vals {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}

.measure-vals b {
  font-weight: 680;
}

.measure-vals span {
  color: var(--ink-3);
  font-size: 11.5px;
}

.del-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--ink-3);
  transition: background 0.18s ease, color 0.18s ease;
}

.del-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.pr-list {
  display: flex;
  flex-direction: column;
}

.pr-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.pr-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.pr-medal {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--lime-soft);
  color: #5b7a17;
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

html[data-theme="dark"] .pr-medal {
  color: var(--lime);
}

.pr-main {
  flex: 1;
  min-width: 0;
}

.pr-main strong {
  display: block;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pr-main span {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--ink-3);
}

.pr-value {
  flex: none;
  text-align: right;
  font-family: var(--font-num);
  font-weight: 720;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.pr-value small {
  display: block;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-3);
}

/* ---------------------------------------------------------- 计划 */

.plan-grid {
  display: grid;
  gap: 8px;
}

.plan-day {
  position: relative;
  padding: 14px 15px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.plan-day.today {
  border-color: rgba(18, 144, 95, 0.5);
  box-shadow: 0 0 0 1px rgba(18, 144, 95, 0.18), var(--shadow-card);
}

.plan-day.today::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.plan-day.rest {
  background: var(--surface-2);
  box-shadow: none;
}

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

.pd-day {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 680;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.pd-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.pd-title {
  margin-top: 6px;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 7px;
}

.pd-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0;
}

.pd-exs {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pd-ex {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-2);
}

.pd-ex span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pd-ex span:last-child {
  flex: none;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.pd-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.pd-rest-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
}

/* ---------------------------------------------------------- 动作库 */

.search-wrap {
  position: relative;
  margin-bottom: 10px;
}

.search-wrap .search-ico {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}

.input.search {
  padding-left: 38px;
  height: 44px;
  border-radius: 13px;
}

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease, border 0.18s ease;
}

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.chip-count {
  opacity: 0.6;
  font-size: 10.5px;
  margin-left: 3px;
}

.lib-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lib-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-radius: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.lib-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lib-name {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 620;
}

.lib-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lib-tags {
  display: flex;
  gap: 5px;
  margin-top: 0;
  flex: none;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tag.muscle {
  background: var(--tag-bg, var(--surface-2));
  color: var(--tag-c, var(--accent));
  box-shadow: inset 0 0 0 1px rgba(127, 145, 135, 0.08);
}

.tag.custom {
  background: var(--lime-soft);
  color: #5b7a17;
}

html[data-theme="dark"] .tag.custom {
  color: var(--lime);
}

.lib-add {
  flex: none;
}

/* ---------------------------------------------------------- 设置 */

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.set-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 17px 16px;
  box-shadow: var(--shadow-card);
}

.set-section h2 {
  font-size: 15.5px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.set-section > p {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.6;
}

.set-body {
  margin-top: 14px;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-row > .field {
  flex: 1;
  min-width: 0;
}

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

.field + .field {
  margin-top: 12px;
}

.field > label,
.field-label {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-size: 16px;
  outline: none;
  transition: border 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b8a80' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.textarea {
  height: auto;
  min-height: 82px;
  padding: 11px 13px;
  resize: vertical;
  line-height: 1.55;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-3);
  font-size: 13px;
}

.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.seg {
  flex: 1;
  height: 34px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 620;
  color: var(--ink-3);
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
}

.seg.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(10, 30, 18, 0.12);
}

html[data-theme="dark"] .seg.active {
  background: var(--surface-3);
}

.goal-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.goal-chip {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-size: 12.5px;
  font-weight: 620;
  color: var(--ink-2);
}

.goal-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.set-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.qr-block {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.qr-box {
  flex: none;
  width: 104px;
  height: 104px;
  padding: 7px;
  border-radius: 13px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.qr-box svg {
  width: 100%;
  height: 100%;
}

.qr-info {
  flex: 1;
  min-width: 0;
}

.qr-info h3 {
  font-size: 13px;
  font-weight: 680;
}

.qr-info p {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.6;
}

.url-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
}

.url-code {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: normal;
  word-break: break-all;
  line-height: 1.4;
  -webkit-user-select: all;
  user-select: all;
}

.copy-btn {
  flex: none;
  height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--bg);
  font-size: 11.5px;
  font-weight: 650;
}

.copy-btn:active {
  opacity: 0.8;
}

.data-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.data-row strong {
  display: block;
  font-size: 13px;
  font-weight: 640;
}

.data-row span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--ink-3);
}

.data-row .btn {
  flex: none;
}

.danger-zone {
  border-color: rgba(207, 75, 69, 0.22);
}

.danger-zone h2 {
  color: var(--danger);
}

.about-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 12px;
  color: var(--ink-3);
}

.about-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.about-list b {
  color: var(--ink-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.about-list code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
}

/* ---------------------------------------------------------- 底部标签栏 */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  padding: 5px 6px calc(5px + var(--safe-bottom));
  background: var(--tabbar-bg);
  border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  backdrop-filter: blur(22px) saturate(1.6);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 3px 0 2px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.18s ease;
}

.tab-ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 27px;
  border-radius: 9px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.tab.active {
  color: var(--accent-2);
}

.tab.active .tab-ico {
  background: var(--accent-soft);
}

.tab:active .tab-ico {
  transform: scale(0.92);
}

/* ---------------------------------------------------------- 弹层 / 表单弹窗 */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(6, 14, 10, 0.46);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade-in 0.22s ease both;
}

.sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 93dvh;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  box-shadow: var(--shadow-float);
  animation: sheet-up 0.34s cubic-bezier(0.18, 0.85, 0.3, 1) both;
  overflow: hidden;
}

.sheet.sheet-tall {
  height: 93dvh;
}

@keyframes sheet-up {
  from { transform: translateY(5%); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet-grip {
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: var(--line-2);
  margin: 8px auto 0;
  flex: none;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px 10px;
  flex: none;
}

.sheet-title {
  font-size: 17.5px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.sheet-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-3);
}

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 18px 22px;
  overscroll-behavior: contain;
}

.sheet-foot {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 11px 18px calc(13px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.sheet-foot .btn {
  flex: 1;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.cols-2 {
  grid-template-columns: 1fr 1fr;
}

.editor-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 0;
  padding: 11px 14px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
}

.editor-total b {
  font-family: var(--font-num);
  font-size: 16px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.editor-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 9px;
}

.editor-section h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.editor-ex {
  padding: 12px;
  border-radius: 15px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.editor-ex + .editor-ex {
  margin-top: 8px;
}

.editor-ex-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ex-index {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-3);
}

.name-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-size: 16px;
  font-weight: 600;
  outline: none;
}

.name-input:focus {
  border-color: var(--accent);
}

.ex-remove {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--ink-3);
}

.ex-remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.set-edit-head {
  display: grid;
  grid-template-columns: 24px 1fr 1fr 30px;
  gap: 8px;
  padding: 10px 0 5px;
  font-size: 9.5px;
  font-weight: 650;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.set-edit-head span:nth-child(2),
.set-edit-head span:nth-child(3) {
  padding-left: 2px;
}

.set-edit-row {
  display: grid;
  grid-template-columns: 24px 1fr 1fr 30px;
  gap: 8px;
  align-items: center;
  padding: 3px 0;
}

.set-num {
  width: 100%;
  height: 36px;
  padding: 0 9px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  outline: none;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
}

.set-num:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.set-del {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink-3);
}

.set-del:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.ex-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 7px;
}

.add-set {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--accent-2);
  padding: 5px 2px;
}

.ex-vol {
  font-size: 10.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.add-ex-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.add-ex-row .btn {
  flex: 1;
}

.add-ex-row .btn:last-child {
  flex: none;
  width: 46px;
  padding: 0;
}

.picker {
  margin-top: 10px;
  padding: 12px;
  border-radius: 15px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

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

.picker-head strong {
  font-size: 12.5px;
}

.picker-list {
  max-height: 260px;
  overflow-y: auto;
  margin-top: 8px;
  -webkit-overflow-scrolling: touch;
}

.picker-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 8px;
  border-radius: 9px;
  text-align: left;
  font-size: 13px;
}

.picker-item:hover {
  background: var(--surface-2);
}

.picker-item .tag {
  margin-left: auto;
  flex: none;
}

.picker-item::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tag-c, var(--accent));
  flex: none;
}

.picker-empty {
  padding: 18px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
}

.picker-muscles {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.picker-muscles::-webkit-scrollbar {
  display: none;
}

.picker-muscles .chip {
  height: 27px;
  padding: 0 10px;
  font-size: 11px;
}

/* 确认弹窗 */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(5, 12, 8, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade-in 0.18s ease both;
}

.dialog {
  width: 100%;
  max-width: 330px;
  padding: 20px 18px 16px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  animation: dialog-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
}

@keyframes dialog-in {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: none; }
}

.dialog h3 {
  font-size: 16.5px;
  font-weight: 720;
  letter-spacing: -0.02em;
  text-align: center;
}

.dialog p {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-2);
  text-align: center;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.dialog-actions .btn {
  flex: 1;
  height: 42px;
  font-size: 13.5px;
}

/* ---------------------------------------------------------- Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  z-index: 90;
  transform: translate(-50%, 14px);
  max-width: min(86vw, 420px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(15, 25, 19, 0.92);
  color: #f0fff6;
  font-size: 12.5px;
  font-weight: 550;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------------------------------------------------- 宽屏 */

@media (min-width: 600px) {
  .view {
    padding-left: 22px;
    padding-right: 22px;
  }

  .hero {
    padding: 26px 26px;
    gap: 22px;
  }

  .hero-ring {
    width: 118px;
    height: 118px;
  }

  .hero-ring .ring-center strong {
    font-size: 22px;
  }

  .hero-actions .btn {
    height: 42px;
    font-size: 14px;
  }

  .plan-grid {
    grid-template-columns: 1fr 1fr;
  }

  .workout-item {
    padding: 14px 16px;
  }
}

@media (min-width: 980px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    width: 254px;
    height: 100dvh;
    flex: none;
    padding: 24px 16px 20px;
    background: var(--bg);
    border-right: 1px solid var(--line);
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 4px 8px;
    border-radius: 14px;
  }

  .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
  }

  .brand-text strong {
    font-size: 15.5px;
    font-weight: 750;
    letter-spacing: -0.02em;
  }

  .brand-text small {
    margin-top: 3px;
    font-size: 10px;
    font-weight: 550;
    color: var(--ink-3);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .side-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 43px;
    margin: 22px 4px 18px;
    border-radius: 13px;
    background: linear-gradient(180deg, #17a870, #0e8659);
    color: #fff;
    font-size: 13.5px;
    font-weight: 650;
    box-shadow: 0 14px 28px -16px rgba(14, 134, 89, 0.9);
    transition: transform 0.18s ease, filter 0.18s ease;
  }

  .side-cta:hover {
    filter: brightness(1.05);
  }

  .side-cta:active {
    transform: scale(0.99);
  }

  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .side-link {
    display: flex;
    align-items: center;
    gap: 11px;
    height: 42px;
    padding: 0 12px;
    border-radius: 11px;
    font-size: 13.5px;
    font-weight: 580;
    color: var(--ink-2);
    transition: background 0.18s ease, color 0.18s ease;
  }

  .side-link svg {
    color: var(--ink-3);
    transition: color 0.18s ease;
  }

  .side-link:hover {
    background: var(--surface-2);
    color: var(--ink);
  }

  .side-link.active {
    background: var(--surface);
    color: var(--ink);
    font-weight: 680;
    box-shadow: 0 1px 2px rgba(12, 35, 22, 0.05), inset 0 0 0 1px var(--line);
  }

  .side-link.active svg {
    color: var(--accent);
  }

  .side-foot {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }

  .server-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-3);
  }

  .side-link-quiet {
    height: 38px;
    margin-top: 2px;
  }

  .side-note {
    padding: 8px 12px 0;
    font-size: 10.5px;
    color: var(--ink-3);
    opacity: 0.75;
  }

  .shell {
    padding-bottom: 0;
  }

  .topbar {
    height: 70px;
    padding: 0 40px;
  }

  .topbar-left {
    font-size: 21px;
    font-weight: 750;
    letter-spacing: -0.03em;
  }

  .topbar .brand-mark-sm {
    display: none;
  }

  .view {
    max-width: 1080px;
    padding: 6px 40px 56px;
  }

  .tabbar {
    display: none;
  }

  .page-head {
    padding: 22px 2px 20px;
  }

  .page-head h1 {
    font-size: 32px;
    letter-spacing: -0.04em;
  }

  .hero {
    padding: 32px 34px;
    border-radius: 32px;
  }

  .hero-ring {
    width: 148px;
    height: 148px;
  }

  .hero-ring .ring-center strong {
    font-size: 27px;
  }

  .hero-ring .ring-center span {
    font-size: 11px;
  }

  .hero-sub {
    font-size: 13.5px;
    max-width: 44ch;
  }

  .stat-row {
    gap: 10px;
    margin-top: 12px;
  }

  .stat-card {
    padding: 14px 15px 13px;
    border-radius: 18px;
  }

  .stat-value {
    font-size: 26px;
  }

  .today-grid {
    grid-template-columns: 1.16fr 0.84fr;
    gap: 10px;
  }

  .card {
    padding: 20px 20px;
    border-radius: 24px;
  }

  .plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .workout-list {
    gap: 8px;
  }

  .toast {
    bottom: 34px;
  }

  .sheet-backdrop {
    align-items: center;
    padding: 28px;
  }

  .sheet {
    width: 100%;
    max-width: 680px;
    max-height: 86vh;
    border-radius: 26px;
  }

  .sheet.sheet-tall {
    height: 86vh;
    max-height: 900px;
  }

  .sheet-grip {
    display: none;
  }

  .sheet-head {
    padding: 20px 22px 12px;
  }

  .sheet-body {
    padding: 4px 22px 26px;
  }

  .sheet-foot {
    padding: 14px 22px;
  }

  .sheet-foot .btn {
    flex: none;
    min-width: 120px;
    margin-left: auto;
  }

  .sheet-foot .btn:first-child {
    margin-left: 0;
  }

  .qr-block {
    max-width: 560px;
  }
}

@media (min-width: 1180px) {
  .plan-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .plan-grid .plan-day:nth-child(7) {
    grid-column: span 1;
  }
}

/* ---------------------------------------------------------- 小屏微调 */

@media (max-width: 380px) {
  .view {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero {
    padding: 18px 16px;
    border-radius: 24px;
    gap: 4px;
  }

  .hero-ring {
    width: 88px;
    height: 88px;
  }

  .ring-center strong {
    font-size: 17px;
  }

  .hero-actions .btn {
    height: 38px;
    font-size: 12.5px;
    padding: 0 12px;
  }

  .stat-value {
    font-size: 19px;
  }

  .page-head h1 {
    font-size: 23px;
  }

  .workout-item {
    padding: 12px;
    gap: 10px;
  }

  .wi-date {
    width: 40px;
  }

  .sync-chip span[data-sync-text] {
    display: none;
  }

  .sync-chip {
    padding: 0 8px;
  }

  .qr-block {
    flex-direction: column;
    align-items: flex-start;
  }

  .qr-box {
    width: 92px;
    height: 92px;
  }
}

@media (max-width: 360px) {
  .topbar .sync-chip span[data-sync-text] {
    display: none;
  }

  .topbar .sync-chip {
    width: 30px;
    justify-content: center;
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------- 补充组件 */

[hidden] {
  display: none !important;
}

.mini-note {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-3);
}

.page-note {
  padding: 18px 6px 4px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-3);
}

.editor-empty {
  padding: 22px 14px;
  border-radius: 14px;
  border: 1px dashed var(--line-2);
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
}

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 130px;
  padding: 18px 14px;
  margin: 4px 0 2px;
  border-radius: 14px;
  border: 1px dashed var(--line);
  background: var(--surface-2);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-3);
  text-align: center;
}

.plan-day-label {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 3px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.plan-ex-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-ex-head,
.plan-ex-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px 80px 30px;
  gap: 6px;
  align-items: center;
}

.plan-ex-head {
  padding: 4px 2px;
  font-size: 9.5px;
  font-weight: 650;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-ex-row + .plan-ex-row {
  margin-top: 2px;
}

.reps-input {
  width: 100%;
  height: 36px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-size: 16px;
  text-align: center;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.reps-input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

/* 模板列表 */

.tpl-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.tpl-item {
  width: 100%;
  padding: 14px 15px;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.tpl-item:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.tpl-item:active {
  transform: scale(0.995);
}

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

.tpl-head strong {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tpl-item p {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-2);
}

.tpl-days {
  margin-top: 8px;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.plan-edit {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink-3);
  transition: background 0.18s ease, color 0.18s ease;
}

.plan-edit:hover {
  background: var(--accent-soft);
  color: var(--accent-2);
}

.weigh-empty {
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0;
}

/* ============================================================
   饮食
   ============================================================ */

.diet-controls {
  margin: 10px 0;
  padding: 10px 12px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.diet-goal-switch {
  max-width: 360px;
  margin-bottom: 9px;
}

.diet-strategy-chips {
  flex-wrap: wrap;
  overflow: visible;
  padding-bottom: 4px;
}

.diet-controls .mini-note {
  margin-top: 2px;
}

.diet-hero {
  position: relative;
  overflow: hidden;
  margin-top: 10px;
  padding: 20px 18px 16px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(122, 166, 39, 0.2);
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(217, 249, 130, 0.7), transparent 60%),
    linear-gradient(140deg, #f9ffe8, #eaf8d4 55%, #ffffff);
  color: #1d2b11;
  box-shadow: 0 20px 44px -28px rgba(86, 123, 26, 0.55);
}

.diet-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -70px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 1px solid rgba(99, 135, 33, 0.14);
  pointer-events: none;
}

html[data-theme="dark"] .diet-hero {
  border-color: rgba(217, 249, 130, 0.16);
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(217, 249, 130, 0.16), transparent 60%),
    linear-gradient(140deg, #162211, #1a2e1c 55%, #121b14);
  color: #efffe2;
  box-shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.8);
}

.diet-hero-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.diet-hero-kicker {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0.72;
}

.diet-day-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 23px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(29, 43, 17, 0.1);
  font-size: 10px;
  font-weight: 650;
}

html[data-theme="dark"] .diet-day-pill {
  background: rgba(217, 249, 130, 0.14);
  color: #d9f982;
}

.diet-kcal {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 8px;
}

.diet-kcal strong {
  font-family: var(--font-num);
  font-size: 38px;
  font-weight: 780;
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.diet-kcal span {
  font-size: 11.5px;
  font-weight: 600;
  opacity: 0.62;
}

.diet-macro-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(29, 43, 17, 0.16);
}

html[data-theme="dark"] .diet-macro-row {
  border-top-color: rgba(217, 249, 130, 0.16);
}

.diet-macro {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-right: 6px;
}

.diet-macro > span {
  font-size: 10.5px;
  font-weight: 600;
  opacity: 0.6;
}

.diet-macro strong {
  font-family: var(--font-num);
  font-size: 21px;
  font-weight: 760;
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.diet-macro small {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  opacity: 0.55;
  margin-left: 2px;
}

.diet-macro em {
  font-style: normal;
  font-size: 9.5px;
  opacity: 0.48;
  font-variant-numeric: tabular-nums;
}

.diet-hero-foot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 12px;
  font-size: 10.5px;
  font-weight: 550;
  opacity: 0.68;
  font-variant-numeric: tabular-nums;
}

.diet-warning {
  position: relative;
  z-index: 1;
  margin-top: 11px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(198, 121, 17, 0.13);
  color: #88540b;
  font-size: 11px;
  line-height: 1.55;
}

html[data-theme="dark"] .diet-warning {
  background: rgba(255, 183, 77, 0.13);
  color: #ffce86;
}

.diet-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.diet-fact {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.diet-fact span {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.03em;
}

.diet-fact b {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

/* 表格 */

.diet-table {
  max-width: 680px;
  margin-top: 2px;
  border-top: 1px solid var(--line);
}

.diet-row {
  display: grid;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.diet-row:last-child {
  border-bottom: 0;
}

.diet-table-cycle .diet-row {
  grid-template-columns: 52px 54px 60px minmax(0, 1fr);
}

.diet-table-taper .diet-row {
  grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}

.diet-row.head {
  padding: 5px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ink-3);
}

.diet-row.today {
  margin: 2px 0;
  padding: 8px 7px;
  border-radius: 10px;
  border-bottom-color: transparent;
  background: var(--accent-soft);
}

.diet-day {
  min-width: 0;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diet-day small {
  display: block;
  margin-top: 1px;
  font-size: 9px;
  font-weight: 500;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
}

.diet-type {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 650;
  white-space: nowrap;
}

.diet-type.high {
  background: #e8f9c8;
  color: #4f6c13;
}

html[data-theme="dark"] .diet-type.high {
  background: rgba(217, 249, 130, 0.14);
  color: #d9f982;
}

.diet-type.mid {
  background: var(--surface-3);
  color: var(--ink-3);
}

.diet-type.low {
  background: #e4eef9;
  color: #3d6488;
}

html[data-theme="dark"] .diet-type.low {
  background: rgba(91, 155, 232, 0.14);
  color: #8fbdff;
}

.diet-num {
  font-size: 11.5px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.diet-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 10px;
  color: var(--ink-3);
}

.diet-daily-macros {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.diet-daily-macros .diet-macro {
  padding: 0 4px;
}

.diet-daily-macros .diet-macro > span {
  color: var(--ink-3);
  opacity: 1;
}

/* 餐次 */

.diet-meal-table {
  max-width: 680px;
  border-top: 1px solid var(--line);
}

.diet-meal-row {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr 0.8fr 0.8fr 0.8fr;
  gap: 6px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.diet-meal-row:last-child {
  border-bottom: 0;
}

.diet-meal-row > span:first-child {
  text-align: left;
  font-weight: 650;
}

.diet-meal-row.head {
  padding: 5px 4px;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

/* 进度条 */

.diet-bars,
.diet-today-bars {
  display: grid;
  gap: 8px;
  margin: 11px 0 13px;
}

.diet-bar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 10px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.diet-bar-head span:first-child {
  font-weight: 600;
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #7fd58f);
  transition: width 0.35s ease;
}

.bar i.over {
  background: linear-gradient(90deg, #e0a23e, #f1c46b);
}

/* 饮食记录 */

.diet-log-form {
  margin-top: 4px;
}

.diet-log-form .field {
  min-width: 0;
}

.diet-history {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.diet-history-title {
  margin-bottom: 2px;
  font-weight: 650;
}

.diet-log-row {
  display: grid;
  grid-template-columns: 44px 74px minmax(0, 1fr) 30px;
  gap: 7px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.diet-log-row:last-child {
  border-bottom: 0;
}

.diet-log-date {
  color: var(--ink-3);
}

.diet-log-cal {
  font-weight: 650;
}

.diet-log-macros {
  color: var(--ink-3);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 方法与食物 */

.diet-method-summary {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-2);
}

.diet-method-bullets {
  display: grid;
  gap: 5px;
  margin: 11px 0 8px;
}

.diet-method-bullets li {
  position: relative;
  padding-left: 13px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-2);
}

.diet-method-bullets li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.diet-details {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.diet-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--accent-2);
}

.diet-details > summary::-webkit-details-marker {
  display: none;
}

.diet-details > summary::after {
  content: "＋";
  flex: none;
  color: var(--ink-3);
  font-weight: 500;
}

.diet-details[open] > summary::after {
  content: "－";
}

.diet-details > summary span {
  margin-left: auto;
  margin-right: 8px;
  font-weight: 500;
  color: var(--ink-3);
  font-size: 10px;
}

.diet-method-list {
  display: grid;
  gap: 6px;
  margin-top: 11px;
}

.diet-method-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--ink-3);
}

.diet-method-item strong {
  flex: none;
  color: var(--ink-2);
  font-size: 11.5px;
}

.diet-source-list {
  display: grid;
  gap: 5px;
  margin-top: 11px;
  font-size: 10.5px;
  line-height: 1.5;
}

.diet-source-list a {
  color: var(--accent-2);
  text-decoration: none;
}

.diet-source-list a:hover {
  text-decoration: underline;
}

.food-ref {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.food-group h4 {
  margin-bottom: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}

.food-row {
  display: grid;
  grid-template-columns: 1fr 58px 1fr;
  gap: 7px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

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

.food-row span:nth-child(2) {
  color: var(--ink-3);
  font-size: 10px;
  text-align: right;
}

.food-row b {
  text-align: right;
  font-weight: 600;
  color: var(--ink-2);
  font-size: 10.5px;
}

.diet-food-card {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.diet-method-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.diet-method-tile {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.diet-method-tile > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.diet-method-tile strong {
  font-size: 13px;
  font-weight: 700;
}

.diet-method-tile p {
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-3);
}

/* 今日页饮食卡 */

.diet-today {
  margin-top: 10px;
}

.diet-today-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 11px;
}

.diet-today-kcal {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.diet-today-kcal strong {
  font-family: var(--font-num);
  font-size: 28px;
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.diet-today-kcal span {
  font-size: 10px;
  color: var(--ink-3);
  font-weight: 600;
}

.diet-today-macros {
  font-size: 10.5px;
  color: var(--ink-3);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.diet-today .btn {
  margin-top: 4px;
}

.diet-setup-card {
  margin-top: 0;
}

/* ============================================================
   动作视频
   ============================================================ */

.video-entry {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 12px;
  padding: 11px 13px;
  border-radius: 16px;
  border: 1px solid rgba(18, 144, 95, 0.2);
  background: linear-gradient(135deg, var(--lime-soft), var(--surface));
  text-align: left;
  color: var(--ink);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.video-entry:active {
  transform: scale(0.995);
}

.video-entry-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--lime);
  color: #1b2a10;
}

.video-entry-icon svg {
  margin-left: 2px;
}

.video-entry-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.video-entry-text strong {
  font-size: 13px;
  font-weight: 680;
}

.video-entry-text small {
  font-size: 10.5px;
  color: var(--ink-3);
}

.video-entry-arrow {
  flex: none;
  color: var(--ink-3);
}

.lib-item {
  width: 100%;
  color: inherit;
  text-align: left;
  font: inherit;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.lib-item:hover {
  border-color: var(--line-2);
}

.lib-item:active {
  transform: scale(0.995);
}

.lib-play {
  flex: none;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-2);
}

.lib-play svg {
  margin-left: 1px;
}

.video-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
}

.video-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0d1e16;
  overflow: hidden;
}

.video-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.68);
  color: #fff;
  font-size: 9.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(217, 249, 130, 0.94);
  color: #15220c;
  box-shadow: 0 10px 26px -10px rgba(0, 0, 0, 0.55);
  transition: transform 0.18s ease, background 0.18s ease;
}

.video-play:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.video-play:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.video-play svg {
  margin-left: 2px;
}

.video-play.small {
  width: 30px;
  height: 30px;
}

.video-play.small svg {
  width: 15px;
  height: 15px;
  margin-left: 1px;
}

.video-info {
  padding: 10px 12px 12px;
}

.video-info strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.45;
  font-weight: 650;
}

.video-info span {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--ink-3);
}

.video-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.video-empty {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.video-empty .btn {
  margin-top: 9px;
}

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

.video-row:last-child {
  border-bottom: 0;
}

.video-row-thumb {
  position: relative;
  flex: none;
  width: 96px;
  aspect-ratio: 16 / 9;
  border-radius: 9px;
  overflow: hidden;
  background: #0d1e16;
}

.video-row-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-row-main {
  flex: 1;
  min-width: 0;
}

.video-row-main strong {
  display: block;
  font-size: 12.5px;
  font-weight: 680;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-row-main span {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-row-main em {
  display: block;
  margin-top: 1px;
  font-style: normal;
  font-size: 9.5px;
  color: var(--ink-3);
}

.video-row-open {
  flex: none;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--ink-3);
}

.video-player {
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

.video-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-player-title {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
}

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

@media (min-width: 600px) {
  .diet-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .diet-method-grid {
    grid-template-columns: 1fr 1fr;
  }

  .diet-hero {
    padding: 24px 24px 18px;
  }

  .diet-kcal strong {
    font-size: 46px;
  }

  .diet-macro strong {
    font-size: 24px;
  }
}

@media (max-width: 380px) {
  .tabbar .tab {
    font-size: 9.5px;
  }

  .tabbar .tab-ico {
    width: 38px;
  }

  .diet-kcal strong {
    font-size: 34px;
  }

  .diet-macro strong {
    font-size: 19px;
  }

  .diet-row {
    gap: 5px;
    font-size: 11px;
  }

  .diet-table-cycle .diet-row {
    grid-template-columns: 48px 50px 54px minmax(0, 1fr);
  }

  .diet-log-row {
    grid-template-columns: 40px 64px minmax(0, 1fr) 30px;
    gap: 5px;
  }

  .video-row-thumb {
    width: 84px;
  }
}

.video-card {
  cursor: pointer;
}

.video-row-thumb,
.video-row-main {
  cursor: pointer;
}

.video-card:focus-visible,
.video-row-main:focus-visible,
.video-row-thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.video-hint {
  margin-top: 8px;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--ink-3);
}

.video-player video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

.video-local-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  background: rgba(217, 249, 130, 0.94);
  color: #1a2a10;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.form-error {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.55;
}

/* ---------------------------------------------------------- 食物库 */

.food-entry {
  background: linear-gradient(135deg, #fff7dc, var(--surface));
  border-color: rgba(228, 178, 75, 0.28);
}

.food-entry .video-entry-icon {
  background: #f3d36d;
  color: #3a2a05;
}

.food-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.food-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font: inherit;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.food-item:hover {
  background: var(--surface-2);
  border-color: var(--line-2);
}

.food-item-main {
  flex: 1;
  min-width: 0;
}

.food-item-main strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.food-item-main small {
  display: block;
  margin-top: 2px;
  font-size: 9.5px;
  color: var(--ink-3);
}

.food-item-macros {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.food-item-macros span b {
  color: var(--ink-2);
  font-weight: 700;
  margin-right: 1px;
}

.food-kcal {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  margin-left: 2px;
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 740;
  color: var(--ink);
}

.food-kcal small {
  font-family: var(--font);
  font-size: 8.5px;
  font-weight: 500;
  color: var(--ink-3);
}

.food-portion-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.food-portion-head strong {
  display: block;
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.food-portion-head span:not(.tag) {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--ink-3);
}

.food-amount-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
}

.food-amount-row label {
  flex: none;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink-3);
}

.food-amount-row .input {
  flex: 1;
  min-width: 0;
}

.food-amount-row > span {
  flex: none;
  font-size: 12px;
  color: var(--ink-3);
}

.food-presets {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.food-presets .chip {
  height: 29px;
  padding: 0 10px;
  font-size: 10.5px;
}

.food-portion-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.food-portion-cell {
  padding: 10px 11px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.food-portion-cell span {
  display: block;
  font-size: 9.5px;
  color: var(--ink-3);
  font-weight: 600;
}

.food-portion-cell strong {
  display: block;
  margin-top: 2px;
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 760;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.food-portion-cell strong small {
  font-family: var(--font);
  font-size: 9.5px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0;
}

.diet-log-items {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.diet-log-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 66px 82px;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.diet-log-item:last-child {
  border-bottom: 0;
}

.diet-log-item span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diet-log-item span:nth-child(2) {
  color: var(--ink-3);
  text-align: right;
  font-size: 10px;
}

.diet-log-item b {
  text-align: right;
  font-weight: 600;
  font-size: 10.5px;
}

@media (min-width: 600px) {
  .food-portion-result {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.45;
  color: var(--ink-3);
}

.food-cats {
  flex-wrap: wrap;
  overflow: visible;
}

.hint-link {
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}
