/* ==========================================================================
   DayTrace — 设计系统
   色彩取自「一天的轨迹」：深松（清晨/坚持）、青柠与松石（有氧）、
   琥珀（餐后阳光）、朱砂（力量）、电蓝与紫罗（数据）。
   ========================================================================== */

:root {
  --paper: #f4f0e7;
  --paper-2: #efe9dd;
  --surface: #ffffff;
  --surface-2: #fbf8f2;
  --overlay: #fffdf8;
  --scrim: rgba(11, 32, 27, 0.44);

  --ink: #10201c;
  --ink-2: #33463f;
  --muted: #5f736d;
  --line: rgba(15, 61, 51, 0.13);
  --line-2: rgba(15, 61, 51, 0.08);

  --pine: #0f3d33;
  --pine-2: #14544a;
  --pine-ink: #f2efe4;

  --coral: #e4572e;
  --amber: #f2a03d;
  --blue: #2f6bff;
  --teal: #12a594;
  --lime: #7cc043;
  --violet: #7c5cff;
  --magenta: #d6427e;

  --ok: #12a594;
  --warn: #d9862a;
  --danger: #d94a26;
  --info: #2f6bff;

  --hm-0: rgba(15, 61, 51, 0.07);
  --hm-1: #cfe6b4;
  --hm-2: #9ed46f;
  --hm-3: #46b391;
  --hm-4: #0f6b58;

  --radius: 20px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --shadow-1: 0 1px 2px rgba(15, 61, 51, 0.05), 0 4px 14px rgba(15, 61, 51, 0.05);
  --shadow-2: 0 10px 40px rgba(15, 61, 51, 0.12);
  --shadow-3: 0 24px 70px rgba(11, 32, 27, 0.24);
  --nav-h: 66px;
  --ease: cubic-bezier(0.22, 0.85, 0.3, 1);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

[data-theme='dark'] {
  --paper: #0a1310;
  --paper-2: #071009;
  --surface: #12201c;
  --surface-2: #16261f;
  --overlay: #172a23;
  --scrim: rgba(3, 10, 8, 0.62);

  --ink: #e9f1ed;
  --ink-2: #c3d4cd;
  --muted: #91a8a0;
  --line: rgba(233, 241, 237, 0.13);
  --line-2: rgba(233, 241, 237, 0.07);

  --pine: #0d3129;
  --pine-2: #12463c;
  --pine-ink: #eaf3ee;

  --coral: #ff7a52;
  --amber: #ffb55c;
  --blue: #7aa2ff;
  --teal: #2ed3be;
  --lime: #a8e86a;
  --violet: #a78bff;
  --magenta: #ff6fa5;

  --ok: #2ed3be;
  --warn: #ffb55c;
  --danger: #ff7a52;
  --info: #7aa2ff;

  --hm-0: rgba(233, 241, 237, 0.07);
  --hm-1: #2c5a3f;
  --hm-2: #3f8b52;
  --hm-3: #57bb7c;
  --hm-4: #8fe6a4;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.24);
  --shadow-2: 0 12px 44px rgba(0, 0, 0, 0.44);
  --shadow-3: 0 26px 80px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }

::selection { background: rgba(242, 160, 61, 0.35); }

/* 滚动条：属于本页自己的视觉语言 */
* { scrollbar-width: thin; scrollbar-color: rgba(15, 61, 51, 0.28) transparent; }
[data-theme='dark'] * { scrollbar-color: rgba(143, 230, 164, 0.3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(15, 61, 51, 0.05); border-radius: 10px; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(18, 165, 148, 0.55), rgba(15, 61, 51, 0.4));
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--teal), var(--pine)); background-clip: padding-box; }
[data-theme='dark'] ::-webkit-scrollbar-track { background: rgba(233, 241, 237, 0.05); }

/* ---------- 背景层 ---------- */
.bg-aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  mix-blend-mode: multiply;
  animation: drift 26s var(--ease) infinite alternate;
}
.bg-aurora span:nth-child(1) { width: 46vw; height: 46vw; left: -12vw; top: -14vw; background: radial-gradient(circle, rgba(18, 165, 148, 0.55), transparent 68%); }
.bg-aurora span:nth-child(2) { width: 40vw; height: 40vw; right: -10vw; top: 4vh; background: radial-gradient(circle, rgba(242, 160, 61, 0.5), transparent 68%); animation-delay: -8s; }
.bg-aurora span:nth-child(3) { width: 52vw; height: 52vw; left: 26vw; bottom: -26vw; background: radial-gradient(circle, rgba(124, 92, 255, 0.32), transparent 70%); animation-delay: -15s; }
[data-theme='dark'] .bg-aurora span { mix-blend-mode: screen; opacity: 0.32; }
.bg-grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}
[data-theme='dark'] .bg-grain { opacity: 0.22; }

@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(4vw, 3vh, 0) scale(1.12); }
}

#fx { position: fixed; inset: 0; z-index: 90; pointer-events: none; }

/* ---------- 基础排版工具 ---------- */
.eyebrow {
  font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.muted { color: var(--muted); }
.tnum { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }
.nowrap { white-space: nowrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 999px; border: 1px solid transparent;
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600;
  transition: transform 0.16s var(--ease), box-shadow 0.2s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap; user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.chip:focus-visible, .set-chip:focus-visible, .nav-tab:focus-visible, .cal-cell:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 2px;
}
.btn.primary { background: linear-gradient(135deg, var(--pine-2), var(--pine)); color: var(--pine-ink); box-shadow: 0 6px 18px rgba(15, 61, 51, 0.24); }
.btn.primary:hover { box-shadow: 0 10px 26px rgba(15, 61, 51, 0.3); }
.btn.accent { background: linear-gradient(135deg, #ffc06a, var(--amber)); color: #40260a; box-shadow: 0 6px 18px rgba(242, 160, 61, 0.32); }
.btn.teal { background: linear-gradient(135deg, #2ec7b3, var(--teal)); color: #04241f; box-shadow: 0 6px 18px rgba(18, 165, 148, 0.28); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface); border-color: rgba(18, 165, 148, 0.45); color: var(--ink); }
.btn.subtle { background: var(--surface-2); border-color: var(--line-2); color: var(--ink-2); }
.btn.danger { background: linear-gradient(135deg, #f0714a, var(--danger)); color: #fff; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.xs { padding: 4px 10px; font-size: 12px; border-radius: 999px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); transition: all 0.18s var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: rgba(18, 165, 148, 0.5); transform: translateY(-1px); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 10px; }
.icon-btn.bare { border-color: transparent; background: transparent; }
.icon-btn.danger:hover { color: var(--danger); border-color: rgba(217, 74, 38, 0.5); }
.icon-btn.on { background: rgba(18, 165, 148, 0.14); border-color: rgba(18, 165, 148, 0.4); color: var(--teal); }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { font-size: 12.5px; font-weight: 650; color: var(--muted); letter-spacing: 0.02em; }
input[type='text'], input[type='password'], input[type='number'], input[type='date'], input[type='time'], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink); transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  font-size: 14px;
}
input:hover, select:hover, textarea:hover { border-color: rgba(18, 165, 148, 0.4); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--teal); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(18, 165, 148, 0.16);
}
textarea { resize: vertical; min-height: 74px; line-height: 1.55; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235f736d' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 6l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}
input[type='number'] { -moz-appearance: textfield; }
input[type='number']::-webkit-outer-spin-button, input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 42px; height: 24px; border-radius: 999px; background: rgba(15, 61, 51, 0.18);
  position: relative; transition: background 0.22s var(--ease); flex: none;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); transition: transform 0.24s var(--ease);
}
.switch input:checked + .track { background: linear-gradient(135deg, var(--teal), var(--pine-2)); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--teal); outline-offset: 2px; }
.switch .switch-label { font-size: 13.5px; font-weight: 600; }

.stepper { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.stepper button {
  width: 30px; height: 32px; border: 0; background: transparent; color: var(--ink-2);
  display: grid; place-items: center; transition: background 0.15s, color 0.15s;
}
.stepper button:hover { background: rgba(18, 165, 148, 0.14); color: var(--teal); }
.stepper input {
  width: 46px; height: 32px; border: 0; background: transparent; text-align: center;
  font-weight: 700; font-variant-numeric: tabular-nums; padding: 0; border-radius: 0;
}
.stepper input:focus { box-shadow: none; background: rgba(18, 165, 148, 0.08); }
.stepper .unit { padding-right: 10px; font-size: 12px; color: var(--muted); font-weight: 600; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; transition: all 0.16s var(--ease);
}
.chip:hover { border-color: rgba(18, 165, 148, 0.45); color: var(--ink); transform: translateY(-1px); }
.chip.on { background: linear-gradient(135deg, var(--pine-2), var(--pine)); border-color: transparent; color: var(--pine-ink); }
.chip.tiny { padding: 3px 9px; font-size: 11.5px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; border: 1px solid transparent;
}

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 60;
  display: flex; align-items: center; gap: 14px; padding: 0 clamp(14px, 3vw, 30px);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line-2);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-name { font-size: 18px; font-weight: 750; letter-spacing: -0.02em; }
.brand-name em { font-style: normal; color: var(--teal); }
.brand-sub { font-size: 10px; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; margin-top: -3px; }
.logo-mark { border-radius: 12px; box-shadow: 0 4px 14px rgba(18, 165, 148, 0.28); flex: none; }

.nav-tabs { display: flex; gap: 2px; margin-left: 8px; background: var(--surface-2); border: 1px solid var(--line-2); padding: 4px; border-radius: 999px; }
.nav-tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 15px; border-radius: 999px;
  border: 0; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 650;
  transition: all 0.2s var(--ease); position: relative;
}
.nav-tab:hover { color: var(--ink); }
.nav-tab.active { background: linear-gradient(135deg, var(--pine-2), var(--pine)); color: var(--pine-ink); box-shadow: 0 4px 14px rgba(15, 61, 51, 0.22); }
.nav-tab .ico { opacity: 0.9; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sync-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); white-space: nowrap;
}
.sync-pill .led { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.sync-pill.saving .led { background: var(--amber); animation: pulse 1s infinite; }
.sync-pill.offline .led, .sync-pill.error .led { background: var(--danger); }
.sync-pill.saved .led { background: var(--ok); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ---------- 布局 ---------- */
main.shell {
  position: relative; z-index: 2; max-width: 1240px; margin: 0 auto;
  padding: calc(var(--nav-h) + 22px) clamp(14px, 3vw, 30px) 90px;
}
.view { animation: viewIn 0.42s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.side-sticky { position: sticky; top: calc(var(--nav-h) + 18px); display: grid; gap: 16px; }
.stack { display: grid; gap: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); padding: 18px; position: relative; overflow: hidden;
  animation: cardIn 0.5s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-size: 16.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-title .ico { color: var(--teal); }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card.flush { padding: 0; }

.empty-mini { padding: 22px; text-align: center; color: var(--muted); font-size: 13.5px; background: var(--surface-2); border-radius: 14px; border: 1px dashed var(--line); }

/* ---------- 今日：Hero ---------- */
.daybar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.daybar .date-input { width: auto; padding: 7px 12px; border-radius: 999px; font-weight: 650; font-size: 13px; }

.hero {
  border-radius: var(--radius-lg); padding: 24px; position: relative; overflow: hidden; color: var(--pine-ink);
  background: radial-gradient(120% 140% at 8% 0%, #1a6152 0%, #12463c 42%, #0b2b25 100%);
  box-shadow: 0 18px 50px rgba(11, 43, 37, 0.32); margin-bottom: 18px;
  animation: cardIn 0.5s var(--ease) both;
}
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 22px; align-items: center; position: relative; z-index: 1; }
.hero-date { display: flex; align-items: baseline; gap: 10px; }
.hero-day { font-size: clamp(40px, 7vw, 60px); font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-month { font-size: 15px; opacity: 0.8; font-weight: 600; }
.hero-title { font-size: 20px; font-weight: 700; margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-note { font-size: 13.5px; opacity: 0.78; margin-top: 6px; max-width: 52ch; }
.hero-eyebrow { font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.66; font-weight: 700; }
.hero .badge { background: rgba(255, 255, 255, 0.14); color: #fff; border-color: rgba(255, 255, 255, 0.22); }
.hero-stats { display: flex; gap: 22px; margin-top: 18px; flex-wrap: wrap; }
.hero-stat b { display: block; font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.2; }
.hero-stat span { font-size: 11.5px; opacity: 0.72; letter-spacing: 0.04em; }
.hero-ring { color: #eafff6; display: grid; place-items: center; }
.hero-ring .ring-num { fill: #fff; }
.hero-ring .ring-sub { fill: rgba(255, 255, 255, 0.7); }
.hero-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .btn.ghost { border-color: rgba(255, 255, 255, 0.28); color: #eaf6f0; }
.hero .btn.ghost:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* ---------- 餐后有氧 ---------- */
.meal-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface-2);
  transition: all 0.22s var(--ease); margin-bottom: 10px;
}
.meal-row:last-child { margin-bottom: 0; }
.meal-row.done { background: linear-gradient(100deg, rgba(124, 192, 67, 0.16), rgba(18, 165, 148, 0.1)); border-color: rgba(18, 165, 148, 0.32); }
.meal-ico { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--amber); flex: none; }
.meal-row.done .meal-ico { background: linear-gradient(135deg, var(--teal), var(--pine-2)); color: #fff; border-color: transparent; }
.meal-name { font-weight: 700; font-size: 14.5px; }
.meal-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.meal-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.meal-select { width: auto; min-width: 108px; padding: 6px 28px 6px 10px; font-size: 12.5px; border-radius: 999px; }
.meal-check {
  width: 38px; height: 38px; border-radius: 13px; border: 1.5px solid var(--line); background: var(--surface);
  display: grid; place-items: center; color: var(--muted); transition: all 0.2s var(--ease); flex: none;
}
.meal-check:hover { border-color: var(--teal); color: var(--teal); transform: scale(1.05); }
.meal-check.on { background: linear-gradient(135deg, var(--teal), var(--pine-2)); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(18, 165, 148, 0.32); }
.meal-check.on .ico { animation: pop 0.34s var(--ease); }
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.18); } 100% { transform: scale(1); opacity: 1; } }

.meal-summary { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding-top: 13px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.bar { height: 8px; border-radius: 999px; background: rgba(15, 61, 51, 0.1); overflow: hidden; flex: 1; min-width: 120px; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--lime), var(--teal)); transition: width 0.5s var(--ease); }
.bar.amber > i { background: linear-gradient(90deg, #ffd08a, var(--amber)); }
.bar.violet > i { background: linear-gradient(90deg, #b9a5ff, var(--violet)); }

/* ---------- 训练项 ---------- */
.ex-item { border: 1px solid var(--line-2); border-radius: 18px; padding: 14px; background: var(--surface-2); margin-bottom: 12px; transition: all 0.24s var(--ease); position: relative; }
.ex-item:last-child { margin-bottom: 0; }
.ex-item::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--ex-color, var(--teal)); opacity: 0.85; }
.ex-item.complete { background: linear-gradient(100deg, rgba(18, 165, 148, 0.1), transparent 70%); border-color: rgba(18, 165, 148, 0.3); }
.ex-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; padding-left: 8px; }
.ex-name { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.ex-target { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ex-note { font-size: 11.5px; color: var(--muted); margin-top: 4px; opacity: 0.9; }
.ex-actions { display: flex; gap: 4px; margin-left: auto; }

.set-grid { display: flex; gap: 8px; flex-wrap: wrap; padding-left: 8px; }
.set-chip {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 12px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); transition: all 0.2s var(--ease); min-width: 108px;
}
.set-chip:hover { border-color: rgba(18, 165, 148, 0.45); transform: translateY(-1px); }
.set-chip.done { background: linear-gradient(135deg, rgba(18, 165, 148, 0.16), rgba(124, 192, 67, 0.14)); border-color: rgba(18, 165, 148, 0.42); }
.set-idx { font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.06em; }
.set-input { width: 42px; border: 0; background: transparent; padding: 2px 0; font-weight: 750; font-size: 15px; text-align: center; font-variant-numeric: tabular-nums; }
.set-input:focus { box-shadow: none; background: rgba(18, 165, 148, 0.1); border-radius: 6px; }
.set-unit { font-size: 11px; color: var(--muted); margin-left: -4px; }
.set-toggle { width: 26px; height: 26px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--surface-2); display: grid; place-items: center; color: transparent; transition: all 0.18s var(--ease); flex: none; }
.set-toggle:hover { border-color: var(--teal); color: rgba(18, 165, 148, 0.5); }
.set-chip.done .set-toggle { background: linear-gradient(135deg, var(--teal), var(--pine-2)); border-color: transparent; color: #fff; }
.set-chip.done .set-toggle .ico { animation: pop 0.3s var(--ease); }

.ex-foot { display: flex; align-items: center; gap: 10px; margin-top: 11px; padding-left: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.quick-mins { display: flex; gap: 6px; flex-wrap: wrap; }

.rest-day { text-align: center; padding: 26px 18px; }
.rest-day .rest-ico { width: 62px; height: 62px; border-radius: 22px; display: grid; place-items: center; margin: 0 auto 12px; background: linear-gradient(135deg, rgba(124, 92, 255, 0.18), rgba(18, 165, 148, 0.14)); color: var(--violet); }
.rest-day h4 { font-size: 17px; margin-bottom: 6px; }
.rest-day p { font-size: 13.5px; color: var(--muted); max-width: 40ch; margin: 0 auto 14px; }

.rpe-row { display: flex; gap: 8px; flex-wrap: wrap; }
.rpe-chip { flex: 1; min-width: 62px; padding: 9px 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); text-align: center; transition: all 0.18s var(--ease); }
.rpe-chip b { display: block; font-size: 16px; font-weight: 750; }
.rpe-chip span { font-size: 10.5px; color: var(--muted); }
.rpe-chip:hover { transform: translateY(-2px); border-color: rgba(242, 160, 61, 0.5); }
.rpe-chip.on { background: linear-gradient(135deg, #ffc884, var(--amber)); border-color: transparent; color: #40260a; }
.rpe-chip.on span { color: rgba(64, 38, 10, 0.75); }

/* ---------- 计时器 ---------- */
.timer-card { text-align: center; }
.timer-dial { position: relative; width: 190px; height: 190px; margin: 6px auto 12px; }
.timer-dial svg { transform: rotate(-90deg); }
.timer-dial .dial-track { stroke: rgba(15, 61, 51, 0.1); }
[data-theme='dark'] .timer-dial .dial-track { stroke: rgba(233, 241, 237, 0.12); }
.timer-dial .dial-arc { stroke: url(#timerGrad); transition: stroke-dashoffset 0.3s linear; }
.timer-readout { position: absolute; inset: 0; display: grid; place-content: center; gap: 2px; }
.timer-time { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1; }
.timer-state { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.timer-card.running .timer-time { color: var(--teal); }
.timer-card.running .timer-dial { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
.timer-presets { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.timer-buttons { display: flex; gap: 8px; justify-content: center; }

.timer-dock {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%) translateY(140%);
  z-index: 70; display: none; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 999px;
  background: var(--pine); color: var(--pine-ink); box-shadow: var(--shadow-2); transition: transform 0.35s var(--ease);
}
.timer-dock.show { transform: translateX(-50%) translateY(0); }
.timer-dock b { font-variant-numeric: tabular-nums; font-size: 18px; }
.timer-dock .icon-btn { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.2); color: #fff; }

/* ---------- 迷你周视图 ---------- */
.week-mini { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wm-cell { padding: 8px 4px; border-radius: 13px; border: 1px solid var(--line-2); background: var(--surface-2); text-align: center; transition: all 0.18s var(--ease); }
.wm-cell:hover { transform: translateY(-2px); border-color: rgba(18, 165, 148, 0.45); }
.wm-cell.today { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(242, 160, 61, 0.18); }
.wm-cell.selected { background: linear-gradient(135deg, var(--pine-2), var(--pine)); color: var(--pine-ink); border-color: transparent; }
.wm-name { font-size: 10.5px; opacity: 0.75; font-weight: 650; }
.wm-num { font-size: 14px; font-weight: 750; font-variant-numeric: tabular-nums; }
.wm-dot { width: 6px; height: 6px; border-radius: 50%; margin: 4px auto 0; background: rgba(15, 61, 51, 0.16); }
.wm-cell.selected .wm-dot { background: rgba(255, 255, 255, 0.3); }

/* ---------- 计划编辑 ---------- */
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day-card {
  padding: 13px 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface);
  text-align: left; transition: all 0.22s var(--ease); position: relative; overflow: hidden; min-height: 116px;
}
.day-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: rgba(18, 165, 148, 0.4); }
.day-card.selected { border-color: transparent; background: linear-gradient(150deg, var(--pine-2), var(--pine)); color: var(--pine-ink); box-shadow: 0 12px 30px rgba(15, 61, 51, 0.26); }
.day-card .dc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.day-card .dc-wd { font-size: 13px; font-weight: 750; }
.day-card .dc-title { font-size: 12.5px; font-weight: 650; margin-bottom: 6px; }
.day-card .dc-list { font-size: 11px; color: var(--muted); line-height: 1.5; }
.day-card.selected .dc-list { color: rgba(255, 255, 255, 0.72); }
.day-card .dc-kind { width: 8px; height: 8px; border-radius: 50%; }
.day-card.is-today::after { content: '今天'; position: absolute; right: 10px; bottom: 9px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; color: var(--amber); }
.day-card.selected.is-today::after { color: #ffd08a; }

.plan-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface-2); margin-bottom: 10px;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}
.plan-item.dragging { opacity: 0.45; }
.plan-item.drag-over { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(18, 165, 148, 0.16); }
.drag-handle { cursor: grab; color: var(--muted); padding: 4px; border-radius: 8px; touch-action: none; }
.drag-handle:hover { color: var(--ink); background: rgba(15, 61, 51, 0.06); }
.pi-name { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.pi-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.mini-field { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.mini-field input, .mini-field select { width: 62px; padding: 5px 8px; font-size: 12.5px; border-radius: 9px; text-align: center; }
.mini-field select { width: auto; text-align: left; padding-right: 26px; }
.mini-field.wide input { width: 78px; }

.ex-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.ex-card { padding: 13px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface-2); transition: all 0.2s var(--ease); position: relative; }
.ex-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); border-color: rgba(18, 165, 148, 0.35); }
.ex-card .ec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ex-card .ec-name { font-weight: 700; font-size: 14px; }
.ex-card .ec-meta { font-size: 11.5px; color: var(--muted); }
.ex-card .ec-note { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.ex-card .ec-actions { position: absolute; right: 8px; top: 8px; display: flex; gap: 3px; opacity: 0; transition: opacity 0.2s; }
.ex-card:hover .ec-actions, .ex-card:focus-within .ec-actions { opacity: 1; }

.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; max-height: 46vh; overflow: auto; padding: 2px; }
.picker-item { padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); text-align: left; transition: all 0.18s var(--ease); }
.picker-item:hover { border-color: var(--teal); transform: translateY(-2px); box-shadow: var(--shadow-1); }
.picker-item b { display: block; font-size: 13.5px; }
.picker-item span { font-size: 11px; color: var(--muted); }

.slot-editor { display: grid; gap: 8px; }
.slot-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }

/* ---------- 月历 ---------- */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 8px; }
.cal-head span { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.08em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-cell {
  position: relative; aspect-ratio: 1 / 1.02; border-radius: 16px; border: 1px solid var(--line-2);
  background: var(--surface-2); padding: 8px; display: flex; flex-direction: column; justify-content: space-between;
  transition: all 0.2s var(--ease); overflow: hidden; text-align: left;
}
.cal-cell:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: rgba(18, 165, 148, 0.45); z-index: 2; }
.cal-cell.out { opacity: 0.42; }
.cal-cell.future { background: transparent; border-style: dashed; }
.cal-cell.today { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(242, 160, 61, 0.2); }
.cal-cell.active { background: linear-gradient(160deg, rgba(18, 165, 148, 0.14), rgba(124, 192, 67, 0.1)); border-color: rgba(18, 165, 148, 0.28); }
.cal-cell.full { background: linear-gradient(160deg, var(--pine-2), var(--pine)); border-color: transparent; color: var(--pine-ink); }
.cal-cell.full .cal-min, .cal-cell.full .cal-num { color: var(--pine-ink); }
.cal-num { font-size: 14px; font-weight: 750; font-variant-numeric: tabular-nums; }
.cal-kind { position: absolute; right: 7px; top: 7px; width: 7px; height: 7px; border-radius: 50%; }
.cal-min { font-size: 10.5px; color: var(--muted); font-weight: 650; }
.cal-dots { display: flex; gap: 3px; margin-top: 3px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.32; }
.cal-dots i.on { opacity: 1; background: var(--teal); }
.cal-cell.full .cal-dots i.on { background: #9fe8b8; }
.cal-bar { height: 4px; border-radius: 3px; background: rgba(15, 61, 51, 0.12); overflow: hidden; margin-top: 4px; }
.cal-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--lime), var(--teal)); }
.cal-cell.full .cal-bar { background: rgba(255, 255, 255, 0.2); }
.cal-cell.full .cal-bar > i { background: linear-gradient(90deg, #ffd08a, #9fe8b8); }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; }
.kpi {
  padding: 15px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface);
  position: relative; overflow: hidden; transition: all 0.22s var(--ease);
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.kpi::after { content: ''; position: absolute; right: -20px; top: -20px; width: 76px; height: 76px; border-radius: 50%; background: var(--kpi-color, var(--teal)); opacity: 0.1; }
.kpi-label { font-size: 11.5px; color: var(--muted); font-weight: 650; letter-spacing: 0.04em; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 27px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 5px; line-height: 1.1; }
.kpi-value em { font-style: normal; font-size: 13px; font-weight: 650; color: var(--muted); margin-left: 3px; }
.kpi-foot { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.kpi .spark { position: absolute; right: 12px; bottom: 10px; opacity: 0.65; }

/* ---------- 图表 ---------- */
.chart-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
.chart { width: 100%; min-width: 520px; height: auto; display: block; color: var(--ink); }
.chart .c-axis { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.chart .c-note { font-size: 11px; font-weight: 700; font-family: var(--font); }
.chart .c-grid { stroke: currentColor; stroke-opacity: 0.1; stroke-width: 1; }
.chart .c-hit:hover { fill: rgba(18, 165, 148, 0.09); }
.heatmap .hm-cell { transition: transform 0.15s var(--ease); }
.heatmap .hm-cell:hover { stroke: var(--ink); stroke-width: 1.5; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 4px; display: inline-block; }
.legend i.hatch { background: repeating-linear-gradient(45deg, #7c5cff, #7c5cff 2px, rgba(255, 255, 255, 0.65) 2px, rgba(255, 255, 255, 0.65) 4px); }
.legend i.dash { height: 0; border-top: 2px dashed; border-radius: 0; width: 14px; }
.hm-legend i { width: 13px; height: 13px; }

.hbars { display: grid; gap: 12px; }
.hbar-head { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 5px; }
.hbar-name { font-weight: 650; }
.hbar-val { margin-left: auto; font-weight: 750; font-variant-numeric: tabular-nums; }
.hbar-val em { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 2px; font-weight: 600; }
.hbar-track { height: 9px; border-radius: 999px; background: rgba(15, 61, 51, 0.08); overflow: hidden; }
[data-theme='dark'] .hbar-track { background: rgba(233, 241, 237, 0.09); }
.hbar-fill { height: 100%; border-radius: 999px; transition: width 0.6s var(--ease); }

.ring-wrap { display: inline-grid; justify-items: center; gap: 6px; color: var(--ink); }
.ring-num { font-size: 20px; font-weight: 800; fill: var(--ink); font-family: var(--font); font-variant-numeric: tabular-nums; }
.ring-pct { font-size: 11px; font-weight: 700; }
.ring-sub { font-size: 9.5px; fill: var(--muted); font-family: var(--font); }
.ring-label { font-size: 12px; color: var(--muted); font-weight: 650; }
.ring-arc { transition: stroke-dashoffset 0.7s var(--ease); }
.rings-row { display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-around; }

.wd-chart, .mc-chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; }
.mc-chart { grid-template-columns: repeat(6, 1fr); }
.wd-col, .mc-col { text-align: center; }
.wd-bar-wrap { height: 108px; display: flex; align-items: flex-end; }
.mc-bar-wrap { height: 120px; display: flex; align-items: flex-end; }
.wd-bar, .mc-bar { width: 100%; border-radius: 8px 8px 4px 4px; transition: height 0.6s var(--ease); min-height: 3px; }
.wd-val, .mc-val { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.wd-name, .mc-name { font-size: 12px; font-weight: 650; margin-top: 6px; }
.mc-sub { font-size: 10.5px; color: var(--muted); }

.chart-tip {
  position: fixed; left: 0; top: 0; z-index: 120; pointer-events: none; opacity: 0;
  padding: 7px 11px; border-radius: 11px; background: var(--pine); color: var(--pine-ink);
  font-size: 12px; font-weight: 600; box-shadow: var(--shadow-2); transition: opacity 0.14s; max-width: 280px;
}
.chart-tip.in { opacity: 1; }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.ach {
  display: flex; gap: 12px; padding: 13px; border-radius: 16px; border: 1px solid var(--line-2);
  background: var(--surface-2); transition: all 0.2s var(--ease);
}
.ach:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); }
.ach.done { background: linear-gradient(135deg, rgba(242, 160, 61, 0.16), rgba(124, 192, 67, 0.12)); border-color: rgba(242, 160, 61, 0.35); }
.ach-ico { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); flex: none; }
.ach.done .ach-ico { background: linear-gradient(135deg, #ffc884, var(--amber)); color: #40260a; border-color: transparent; }
.ach b { font-size: 13.5px; }
.ach p { font-size: 11.5px; color: var(--muted); }
.ach .bar { margin-top: 6px; height: 5px; }

/* ---------- 抽屉 / 模态 / Toast ---------- */
.layer { position: fixed; inset: 0; z-index: 100; }
.scrim { position: absolute; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.26s var(--ease); }
.layer.in .scrim { opacity: 1; }

.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(0.97); opacity: 0;
  width: min(560px, calc(100vw - 28px)); max-height: min(86vh, 760px); display: flex; flex-direction: column;
  background: var(--overlay); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-3);
  transition: all 0.28s var(--ease); overflow: hidden;
}
.layer.in .modal { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.modal-sm { width: min(420px, calc(100vw - 28px)); }
.modal-lg { width: min(760px, calc(100vw - 28px)); }
.modal-head, .drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line-2); }
.modal-head h3, .drawer-head h3 { font-size: 17px; }
.modal-head p, .drawer-head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal-body { padding: 18px 20px; overflow: auto; display: grid; gap: 14px; }
.modal-foot, .drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-2); background: var(--surface-2); flex-wrap: wrap; }
.modal-danger .modal-head h3 { color: var(--danger); }
.confirm-text { font-size: 14px; color: var(--ink-2); line-height: 1.65; }

.drawer {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(460px, 100vw); display: flex; flex-direction: column;
  background: var(--overlay); border-left: 1px solid var(--line); box-shadow: var(--shadow-3);
  transform: translateX(100%); transition: transform 0.32s var(--ease);
}
.layer.in .drawer { transform: none; }
.drawer-body { padding: 18px 20px 26px; overflow: auto; display: grid; gap: 16px; align-content: start; }

.setting-group { display: grid; gap: 12px; padding: 14px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface-2); }
.setting-group > h4 { font-size: 13px; letter-spacing: 0.04em; color: var(--muted); text-transform: uppercase; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.setting-row .sr-text b { font-size: 13.5px; display: block; }
.setting-row .sr-text span { font-size: 11.5px; color: var(--muted); }

#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 130; display: grid; gap: 8px; width: min(460px, calc(100vw - 24px)); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 16px;
  background: var(--pine); color: var(--pine-ink); box-shadow: var(--shadow-2);
  opacity: 0; transform: translateY(14px); transition: all 0.28s var(--ease); font-size: 13.5px;
}
.toast.in { opacity: 1; transform: none; }
.toast-success { background: linear-gradient(120deg, #146152, #0f3d33); }
.toast-danger { background: linear-gradient(120deg, #b8401f, #7d2a13); }
.toast-msg { flex: 1; }
.toast-action { border: 1px solid rgba(255, 255, 255, 0.32); background: rgba(255, 255, 255, 0.12); color: #fff; padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.toast-action:hover { background: rgba(255, 255, 255, 0.22); }
.toast-close { border: 0; background: transparent; color: rgba(255, 255, 255, 0.6); display: grid; place-items: center; padding: 2px; }
.toast-close:hover { color: #fff; }

/* ---------- 登录 ---------- */
.lock {
  position: fixed; inset: 0; z-index: 80; display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--paper); animation: viewIn 0.5s var(--ease) both;
}
.lock-brand {
  position: relative; overflow: hidden; padding: clamp(28px, 5vw, 60px); display: flex; flex-direction: column;
  justify-content: space-between; color: var(--pine-ink);
  background: radial-gradient(120% 120% at 12% 8%, #1a6152 0%, #12463c 45%, #08211c 100%);
}
.lock-brand::after {
  content: ''; position: absolute; inset: 0; opacity: 0.45; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.4'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
.lock-brand > * { position: relative; z-index: 1; }
.lock-logo { display: flex; align-items: center; gap: 12px; }
.lock-logo b { font-size: 22px; letter-spacing: -0.02em; }
.lock-headline { font-size: clamp(28px, 3.6vw, 42px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.22; margin: 26px 0 14px; }
.lock-headline em { font-style: normal; color: #ffd08a; }
.lock-desc { font-size: 14px; opacity: 0.78; max-width: 40ch; line-height: 1.75; }
.lock-points { display: grid; gap: 12px; margin-top: 26px; }
.lock-point { display: flex; gap: 11px; align-items: flex-start; font-size: 13.5px; opacity: 0.9; }
.lock-point .lp-ico { width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.12); color: #9fe8b8; flex: none; }
.lock-foot { font-size: 11.5px; opacity: 0.55; letter-spacing: 0.06em; }
.lock-trace { position: absolute; right: -40px; bottom: -30px; width: 320px; opacity: 0.16; z-index: 0; }

.lock-panel { display: grid; place-items: center; padding: 24px; position: relative; z-index: 2; }
.lock-card { width: min(400px, 100%); display: grid; gap: 16px; }
.lock-card h2 { font-size: 24px; letter-spacing: -0.02em; }
.lock-card .sub { font-size: 13.5px; color: var(--muted); }
.pw-wrap { position: relative; }
.pw-wrap input { padding: 14px 46px 14px 16px; border-radius: 16px; font-size: 16px; letter-spacing: 0.08em; background: var(--surface); }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--ink); background: rgba(15, 61, 51, 0.06); }
.lock-error { font-size: 13px; color: var(--danger); display: flex; align-items: center; gap: 6px; min-height: 20px; }
.lock-hint { font-size: 12px; color: var(--muted); line-height: 1.7; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--line); }
.lock-hint code { background: rgba(18, 165, 148, 0.14); padding: 1px 6px; border-radius: 6px; font-size: 12px; color: var(--ink); }
.shake { animation: shake 0.4s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

/* ---------- 加载 ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; z-index: 70; background: var(--paper); }
.boot-inner { display: grid; justify-items: center; gap: 14px; }
.boot-bar { width: 160px; height: 4px; border-radius: 4px; background: rgba(15, 61, 51, 0.12); overflow: hidden; }
.boot-bar i { display: block; width: 40%; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--teal), var(--lime)); animation: slide 1.1s var(--ease) infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; font-size: 13px; margin-bottom: 14px; border: 1px solid; }
.banner.warn { background: rgba(242, 160, 61, 0.14); border-color: rgba(242, 160, 61, 0.4); color: #7a4d0d; }
[data-theme='dark'] .banner.warn { color: #ffd08a; }
.banner.info { background: rgba(47, 107, 255, 0.1); border-color: rgba(47, 107, 255, 0.3); color: var(--info); }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: 1fr; }
  .side-sticky { position: static; }
  .week-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .lock { grid-template-columns: 1fr; }
  .lock-brand { display: none; }
  .timer-dock { display: flex; }
  .nav-tab span { display: none; }
  .nav-tab { padding: 8px 12px; }
  .brand-sub { display: none; }
}
@media (max-width: 720px) {
  :root { --nav-h: 60px; }
  body { font-size: 14.5px; }
  main.shell { padding-top: calc(var(--nav-h) + 16px); padding-bottom: 96px; }
  .hero { padding: 18px; border-radius: 22px; }
  .hero-grid { grid-template-columns: 1fr; gap: 14px; }
  .hero-ring { justify-self: start; }
  .hero-stats { gap: 16px; }
  .card { padding: 15px; border-radius: 18px; }
  .week-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meal-row { grid-template-columns: auto 1fr; }
  .meal-controls { grid-column: 1 / -1; justify-content: flex-start; }
  .cal-grid, .cal-head { gap: 5px; }
  .cal-cell { padding: 5px; border-radius: 12px; aspect-ratio: 1 / 1.12; }
  .cal-num { font-size: 12.5px; }
  .cal-min { font-size: 9.5px; }
  .cal-dots { display: none; }
  .kpi-value { font-size: 23px; }
  .plan-item { grid-template-columns: auto 1fr; }
  .plan-item > .row:last-child { grid-column: 1 / -1; justify-content: flex-end; }
  .topbar { gap: 8px; padding: 0 12px; }
  .brand-name { font-size: 16px; }
  .nav-tabs { margin-left: 0; padding: 3px; }
  .sync-pill span { display: none; }
  .sync-pill { padding: 6px; }
  .drawer { width: 100vw; }
  .ex-lib { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .set-chip { min-width: calc(50% - 4px); }
  .hero-day { font-size: 42px; }
  .timer-dial { width: 168px; height: 168px; }
}

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

@media print {
  .topbar, .timer-dock, #toast-root, .bg-aurora, .bg-grain, .hero-actions, .daybar { display: none !important; }
  body { background: #fff; }
  main.shell { padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
}
