/* ============================================================
   小姜康复工作台 · 马卡龙毛玻璃拟态风格
   移动端优先 / iOS Safari 适配
   ============================================================ */

:root {
  /* 马卡龙主色板 */
  --m-mint:    #A8E6CF;
  --m-mint-d:  #6FCF97;
  --m-pink:    #FFD3E0;
  --m-pink-d:  #FF9EBB;
  --m-lav:     #D9CFFF;
  --m-lav-d:   #A594F9;
  --m-lemon:   #FFF3B0;
  --m-lemon-d: #F2C94C;
  --m-sky:     #BFE9FF;
  --m-sky-d:   #56CCF2;
  --m-peach:   #FFD9C0;
  --m-peach-d: #F2994A;

  --text-1: #3A3A4A;
  --text-2: #6B6B80;
  --text-3: #9A9AB0;

  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.75);
  --glass-brd: rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 8px 32px rgba(140, 140, 190, 0.16);
  --glass-shadow-sm: 0 4px 16px rgba(140, 140, 190, 0.12);

  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 12px;

  --nav-w: 96px;
  --nav-w-tab: 210px;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
               "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: var(--text-1);
  background:
    radial-gradient(1200px 800px at 8% 4%,  rgba(168,230,207,.60), transparent 55%),
    radial-gradient(1000px 700px at 96% 8%, rgba(255,211,224,.60), transparent 55%),
    radial-gradient(1100px 900px at 50% 100%, rgba(217,207,255,.55), transparent 60%),
    radial-gradient(900px 700px at 100% 70%, rgba(191,233,255,.50), transparent 55%),
    linear-gradient(160deg, #FDFBFF 0%, #F5FBFF 50%, #FFF9FB 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.65;
  overscroll-behavior: none;
}

/* 顶部装饰光斑 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(420px 420px at 20% 30%, rgba(255,243,176,.30), transparent 70%),
    radial-gradient(380px 380px at 80% 75%, rgba(255,217,192,.28), transparent 70%);
  z-index: 0;
}

/* ==================== 布局 ==================== */
.app {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100%;
  height: 100dvh;
}

/* ---------- 左侧导航 ---------- */
.sidebar {
  flex: 0 0 var(--nav-w);
  width: var(--nav-w);
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border-right: 1px solid var(--glass-brd);
  box-shadow: var(--glass-shadow);
  padding: calc(var(--sat) + 10px) 6px calc(var(--sab) + 10px) calc(var(--sal) + 6px);
  overflow: hidden;
  z-index: 20;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0 12px;
  flex-shrink: 0;
}
.brand-logo {
  width: 42px; height: 42px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 22px;
  background: linear-gradient(135deg, var(--m-mint), var(--m-sky));
  box-shadow: 0 6px 18px rgba(111,207,151,.35);
}
.brand-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--text-2);
  text-align: center;
  line-height: 1.25;
}

.nav-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 8px;
}
.nav-scroll::-webkit-scrollbar { width: 0; display: none; }

/* 左侧导航搜索框 */
.nav-search {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 8px 6px;
  padding: 7px 10px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 12px;
  box-shadow: inset 0 1px 2px rgba(120,120,160,.10);
}
.nav-search .ns-icon { font-size: 13px; opacity: .6; flex-shrink: 0; }
.nav-search .ns-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  color: var(--text-1);
  font-family: inherit;
}
.nav-search .ns-input::placeholder { color: var(--text-3); }
/* 隐藏 type=search 默认清除按钮，用自定义 */
.nav-search .ns-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.nav-search .ns-clear {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,.12);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-search .ns-clear:hover { background: #EB5757; }

/* 搜索结果列表 */
.search-results {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding: 0 8px 12px;
}
.search-results::-webkit-scrollbar { width: 0; display: none; }
.search-results .sr-group { margin-bottom: 8px; }
.search-results .sr-head {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-2);
  padding: 6px 4px 3px;
  letter-spacing: .2px;
}
.search-results .sr-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  margin: 2px 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(255,255,255,.45);
  cursor: pointer;
  font-family: inherit;
}
.search-results .sr-item:hover {
  background: var(--glass-bg-strong);
  border-color: rgba(255,255,255,.9);
}
.search-results .sr-tab {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  align-self: flex-start;
  padding: 1px 7px;
  border-radius: 8px;
}
.search-results .sr-snippet {
  font-size: 12px;
  color: var(--text-1);
  line-height: 1.35;
}
.search-results .sr-empty {
  font-size: 12.5px;
  color: var(--text-3);
  text-align: center;
  padding: 16px 8px;
  line-height: 1.5;
}
/* 导航项命中高亮 */
.nav-item.matched { background: rgba(111,207,151,.18); }

.nav-group-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-3);
  padding: 10px 2px 6px;
  letter-spacing: .3px;
  text-align: center;
  line-height: 1.2;
}
.nav-group-title span.gt-icon { font-size: 13px; }

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 2px;
  margin: 4px 2px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .18s ease, background .2s ease, box-shadow .2s ease;
  text-align: center;
  user-select: none;
}
.nav-item .ni-icon { font-size: 19px; line-height: 1; }
.nav-item .ni-text {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-2);
  line-height: 1.25;
  letter-spacing: -.2px;
}
.nav-item:active { transform: scale(.94); }
.nav-item.active {
  background: var(--glass-bg-strong);
  border-color: rgba(255,255,255,.9);
  box-shadow: 0 4px 14px rgba(140,140,190,.20), inset 0 1px 0 rgba(255,255,255,.9);
}
.nav-item.active .ni-text { color: var(--text-1); font-weight: 800; }
.nav-item.active::after {
  content: '';
  position: absolute;
}

.nav-divider {
  height: 1px;
  margin: 8px 8px;
  background: linear-gradient(90deg, transparent, rgba(150,150,190,.25), transparent);
}

/* ---------- 主内容区 ---------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--sat) + 10px) calc(var(--sar) + 14px) 10px 14px;
  background: rgba(255,255,255,.42);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,.65);
}
.tb-icon {
  width: 38px; height: 38px;
  flex-shrink: 0;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px;
  background: linear-gradient(135deg, var(--m-pink), var(--m-lav));
  box-shadow: 0 4px 12px rgba(165,148,249,.28);
}
.tb-text { width: 220px; flex-shrink: 0; }
.tb-title { font-size: 17px; font-weight: 800; letter-spacing: -.2px; white-space: nowrap; }
.tb-sub {
  font-size: 11.5px; color: var(--text-3); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-date {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  background: rgba(255,255,255,.7);
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.9);
}

/* 患者切换栏 */
.userbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 42vw;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.userbar::-webkit-scrollbar { display: none; }
.uchip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  background: rgba(255,255,255,.6);
  border: 1px solid rgba(255,255,255,.85);
  padding: 5px 11px 5px 9px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s ease, box-shadow .2s ease;
}
.uchip .udot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--uc, #6FCF97);
  box-shadow: 0 0 0 2px rgba(255,255,255,.7);
}
.uchip .udel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  margin-left: 2px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 16px;
  color: var(--text-2);
  background: rgba(0,0,0,.06);
  transition: background .15s ease, color .15s ease;
  position: relative;
  top: 0.5px;
}
.uchip .uname {
  display: inline-block;
  line-height: 1;
  transform: translateY(0.5px);
}
.uchip .udel:hover {
  background: #EB5757;
  color: #fff;
}
.uchip.on .udel {
  background: rgba(46,74,62,.12);
}
.uchip.on .udel:hover {
  background: #EB5757;
  color: #fff;
}
.uchip.on {
  color: #2E4A3E;
  background: linear-gradient(135deg, var(--m-mint), var(--m-sky));
  border-color: rgba(255,255,255,.95);
  box-shadow: 0 4px 12px rgba(111,207,151,.4);
}
.uchip:active { transform: scale(.94); }
.uchip.add {
  font-size: 15px;
  line-height: 1;
  color: var(--m-grape);
  padding: 4px 10px;
}

/* Tab 条 */
.tabs {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  padding: 10px 12px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 20px;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
  user-select: none;
}
.tab:active { transform: scale(.95); }
.tab.active {
  color: #2E4A3E;
  background: linear-gradient(135deg, var(--m-mint), var(--m-sky));
  border-color: rgba(255,255,255,.95);
  box-shadow: 0 4px 14px rgba(111,207,151,.35);
}

.content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px calc(var(--sar) + 12px) calc(var(--sab) + 28px) 12px;
}

/* ==================== 卡片 ==================== */
.card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-shadow-sm), inset 0 1px 0 rgba(255,255,255,.75);
  padding: 16px;
  margin-bottom: 12px;
  animation: fadeUp .35s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.card-dot {
  width: 26px; height: 26px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}
.card-title { font-size: 15px; font-weight: 800; letter-spacing: -.2px; }
.card-tag {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-3);
  background: rgba(255,255,255,.7);
  padding: 3px 9px;
  border-radius: 12px;
}

/* 条目列表 */
.item-list { display: flex; flex-direction: column; gap: 10px; }
.item {
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: var(--r-md);
  padding: 11px 13px;
}
.item-t {
  font-size: 13.5px;
  font-weight: 800;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.item-t::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--m-mint-d);
}
.item-d { font-size: 12.8px; color: var(--text-2); line-height: 1.7; }

/* 贴士列表 */
.tip-list { display: flex; flex-direction: column; gap: 8px; }
.tip {
  display: flex;
  gap: 9px;
  background: linear-gradient(135deg, rgba(255,243,176,.42), rgba(255,217,192,.32));
  border: 1px solid rgba(255,255,255,.85);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 12.8px;
  line-height: 1.7;
  color: #5A5340;
}
.tip-n {
  flex-shrink: 0;
  width: 19px; height: 19px;
  margin-top: 1px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10.5px;
  font-weight: 800;
  color: #7A6420;
  background: rgba(255,255,255,.85);
}

/* ==================== 训练计算器 ==================== */
.calc-ctrl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field-l { font-size: 11.5px; font-weight: 700; color: var(--text-2); padding-left: 2px; }
.seg {
  display: flex;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
}
.seg button {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-2);
  padding: 6px 2px;
  border-radius: 9px;
  cursor: pointer;
  transition: all .18s ease;
}
.seg button.on {
  background: #fff;
  color: var(--text-1);
  box-shadow: 0 2px 8px rgba(140,140,190,.18);
}

.slider-box {
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 12px;
  padding: 8px 12px 4px;
}
.slider-val { font-size: 12px; font-weight: 800; color: var(--m-lav-d); }
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--m-mint), var(--m-lav));
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  margin-top: -6.5px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--m-lav-d);
  box-shadow: 0 2px 6px rgba(140,140,190,.35);
}

.calc-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.crow {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.6);
  border: 1px solid rgba(255,255,255,.85);
  border-radius: var(--r-md);
  padding: 10px 12px;
}
.crow-main { flex: 1; min-width: 0; }
.crow-n { font-size: 13px; font-weight: 800; }
.crow-note { font-size: 11px; color: var(--text-3); }
.crow-v {
  flex-shrink: 0;
  text-align: right;
}
.crow-num {
  font-size: 17px;
  font-weight: 900;
  color: var(--m-lav-d);
  letter-spacing: -.5px;
}
.crow-unit { font-size: 11px; color: var(--text-3); font-weight: 700; margin-left: 2px; }
.crow-set { font-size: 10.5px; color: var(--text-3); }

.calc-summary {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.sum-box {
  text-align: center;
  background: linear-gradient(135deg, rgba(168,230,207,.42), rgba(191,233,255,.38));
  border: 1px solid rgba(255,255,255,.85);
  border-radius: var(--r-md);
  padding: 10px 4px;
}
.sum-n { font-size: 18px; font-weight: 900; letter-spacing: -.5px; color: #2E5A4A; }
.sum-l { font-size: 10.5px; color: var(--text-2); font-weight: 700; }

/* ==================== 分阶段方案 ==================== */
.stage {
  border-radius: var(--r-lg);
  border: 1px solid rgba(255,255,255,.8);
  background: rgba(255,255,255,.5);
  margin-bottom: 11px;
  overflow: hidden;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.stage-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  cursor: pointer;
  user-select: none;
}
.stage-idx {
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
}
.stage-info { flex: 1; min-width: 0; }
.stage-n { font-size: 13.5px; font-weight: 800; }
.stage-t { font-size: 11px; color: var(--text-3); font-weight: 600; }
.stage-arrow {
  font-size: 12px;
  color: var(--text-3);
  transition: transform .25s ease;
  flex-shrink: 0;
}
.stage.open .stage-arrow { transform: rotate(180deg); }

.stage-body {
  display: none;
  padding: 0 14px 14px;
}
.stage.open .stage-body { display: block; animation: fadeUp .25s ease both; }

.stage-goal {
  font-size: 12.3px;
  color: #4A5B52;
  background: rgba(168,230,207,.28);
  border-radius: 12px;
  padding: 9px 11px;
  margin-bottom: 10px;
  line-height: 1.65;
}
.stage-goal b { color: #2E5A4A; }

.chk-list { display: flex; flex-direction: column; gap: 7px; }
.chk {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: rgba(255,255,255,.65);
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 13px;
  padding: 9px 11px;
  cursor: pointer;
  transition: all .18s ease;
  user-select: none;
}
.chk:active { transform: scale(.985); }
.chk-box {
  flex-shrink: 0;
  width: 19px; height: 19px;
  margin-top: 1px;
  border-radius: 6.5px;
  border: 2px solid rgba(150,150,190,.4);
  background: rgba(255,255,255,.9);
  display: grid; place-items: center;
  font-size: 11px;
  color: transparent;
  transition: all .18s ease;
}
.chk.done .chk-box {
  background: linear-gradient(135deg, var(--m-mint-d), var(--m-sky-d));
  border-color: transparent;
  color: #fff;
}
.chk-txt { font-size: 12.6px; line-height: 1.6; color: var(--text-1); }
.chk.done .chk-txt { color: var(--text-3); text-decoration: line-through; }

.stage-caution {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  font-size: 12px;
  line-height: 1.6;
  background: linear-gradient(135deg, rgba(255,211,224,.45), rgba(255,217,192,.35));
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 13px;
  padding: 9px 11px;
  color: #7A4A55;
}
.stage-caution b { color: #A6435C; }

.stage-prog {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bar {
  flex: 1;
  height: 7px;
  border-radius: 4px;
  background: rgba(150,150,190,.18);
  overflow: hidden;
}
.bar-in {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--m-mint-d), var(--m-sky-d));
  transition: width .35s ease;
}
.bar-txt { font-size: 11px; font-weight: 800; color: var(--text-2); flex-shrink: 0; }

/* ==================== 康复进度 ==================== */
.prog-hero {
  text-align: center;
  padding: 4px 0 6px;
}
.ring-wrap { position: relative; width: 148px; height: 148px; margin: 0 auto 6px; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
}
.ring-num { font-size: 34px; font-weight: 900; letter-spacing: -1.5px; color: #2E5A4A; line-height: 1; }
.ring-lbl { font-size: 11px; font-weight: 700; color: var(--text-3); margin-top: 3px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}
.stat {
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,.85);
  padding: 12px 10px;
  text-align: center;
}
.stat-n { font-size: 21px; font-weight: 900; letter-spacing: -.8px; line-height: 1.15; }
.stat-l { font-size: 11px; font-weight: 700; color: var(--text-2); margin-top: 1px; }
.st-mint  { background: linear-gradient(135deg, rgba(168,230,207,.48), rgba(168,230,207,.22)); }
.st-pink  { background: linear-gradient(135deg, rgba(255,211,224,.52), rgba(255,211,224,.24)); }
.st-lav   { background: linear-gradient(135deg, rgba(217,207,255,.52), rgba(217,207,255,.24)); }
.st-sky   { background: linear-gradient(135deg, rgba(191,233,255,.52), rgba(191,233,255,.24)); }

/* 疼痛记录 */
.pain-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.pain-val {
  flex-shrink: 0;
  width: 46px;
  text-align: center;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -1px;
}
.pain-face { font-size: 22px; flex-shrink: 0; }
input[type=range].pain::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, #A8E6CF 0%, #FFF3B0 45%, #FFD3E0 75%, #FF9EBB 100%);
}
input[type=range].pain::-webkit-slider-thumb { border-color: var(--m-pink-d); }

/* 迷你日历热力 */
.heat {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-top: 4px;
}
.heat-c {
  aspect-ratio: 1;
  border-radius: 7px;
  background: rgba(150,150,190,.12);
  display: grid;
  place-items: center;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-3);
  border: 1px solid rgba(255,255,255,.6);
}
.heat-c.today { outline: 2px solid var(--m-lav-d); outline-offset: 1px; }
.heat-lv1 { background: rgba(168,230,207,.35); color: #3E6B58; }
.heat-lv2 { background: rgba(168,230,207,.6);  color: #2E5A4A; }
.heat-lv3 { background: var(--m-mint);          color: #245043; }
.heat-lv4 { background: var(--m-mint-d);        color: #fff; }
.heat-legend {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 4px; margin-top: 8px; font-size: 10px; color: var(--text-3);
}
.heat-legend i { width: 11px; height: 11px; border-radius: 3.5px; display: inline-block; }

/* 按钮 */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  flex: 1;
  min-width: 96px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 14px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 12.8px;
  font-weight: 800;
  color: var(--text-1);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .2s ease;
  background: rgba(255,255,255,.6);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.btn:active { transform: scale(.96); }
.btn-mint { background: linear-gradient(135deg, var(--m-mint), var(--m-sky)); color: #2A5347; }
.btn-pink { background: linear-gradient(135deg, var(--m-pink), var(--m-peach)); color: #7A4550; }
.btn-lav  { background: linear-gradient(135deg, var(--m-lav), var(--m-sky));  color: #3F3A66; }

/* 记录列表 */
.log-list { display: flex; flex-direction: column; gap: 7px; max-height: 320px; overflow-y: auto; }
.log {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.6);
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 13px;
  padding: 9px 11px;
}
.log-d { font-size: 11.5px; font-weight: 800; color: var(--text-2); flex-shrink: 0; width: 46px; }
.log-b { flex: 1; min-width: 0; }
.log-t { font-size: 12px; font-weight: 700; }
.log-s { font-size: 10.5px; color: var(--text-3); }
.log-p {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,.8);
}

.empty {
  text-align: center;
  padding: 26px 12px;
  color: var(--text-3);
  font-size: 12.5px;
}
.empty-ic { font-size: 34px; display: block; margin-bottom: 6px; opacity: .75; }

/* 模式开关 */
.mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.85);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.mode-txt { flex: 1; min-width: 0; }
.mode-t { font-size: 12.8px; font-weight: 800; }
.mode-s { font-size: 10.8px; color: var(--text-3); }
.switch {
  flex-shrink: 0;
  width: 48px; height: 27px;
  border-radius: 14px;
  background: rgba(150,150,190,.28);
  position: relative;
  cursor: pointer;
  transition: background .22s ease;
  border: none;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.16);
  transition: transform .22s ease;
}
.switch.on { background: linear-gradient(135deg, var(--m-mint-d), var(--m-sky-d)); }
.switch.on::after { transform: translateX(21px); }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sab) + 28px);
  transform: translate(-50%, 20px);
  background: rgba(58,58,74,.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 12.8px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 20px;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: all .28s cubic-bezier(.2,.9,.3,1.3);
  max-width: 82vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==================== 自定义模态弹窗 ==================== */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(60, 55, 90, .32);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  animation: maskIn .18s ease;
}
.modal-mask[hidden] { display: none; }
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%;
  max-width: 340px;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(80, 70, 130, .28);
  padding: 22px 20px 18px;
  animation: cardIn .22s cubic-bezier(.2, .9, .3, 1.25);
}
@keyframes cardIn { from { transform: scale(.92) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 16.5px; font-weight: 800; color: var(--text-1); margin-bottom: 8px; }
.modal-body { font-size: 13.5px; line-height: 1.65; color: var(--text-2); margin-bottom: 14px; word-break: break-word; }
.modal-input {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 15px;
  color: var(--text-1);
  background: rgba(255, 255, 255, .85);
  border: 1.5px solid rgba(150, 150, 190, .3);
  border-radius: 13px;
  padding: 11px 13px;
  margin-bottom: 16px;
  outline: none;
  transition: border-color .2s ease;
}
.modal-input:focus { border-color: var(--m-grape); }
.modal-actions { display: flex; gap: 10px; }
.modal-btn {
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  min-height: 44px;
  padding: 11px 0;
  border-radius: 13px;
  border: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: transform .12s ease, box-shadow .2s ease;
  box-sizing: border-box;
}
.modal-btn:active { transform: scale(.96); }
.modal-btn.primary {
  color: #fff;
  background: #B565D8;
  background-image: linear-gradient(135deg, var(--m-grape), #C98BE0);
  box-shadow: 0 6px 16px rgba(187, 107, 217, .35);
  text-shadow: 0 1px 0 rgba(0,0,0,.12);
}
.modal-btn.ghost {
  color: var(--text-2);
  background: rgba(150, 150, 190, .18);
  border: 1px solid rgba(150, 150, 190, .22);
}

/* ==================== 响应式 ==================== */
/* 小屏手机 */
@media (max-width: 360px) {
  :root { --nav-w: 82px; }
  .nav-item .ni-text { font-size: 9.8px; }
  .calc-ctrl { grid-template-columns: 1fr; }
}

/* 平板 / iPad：导航展开为带文字横排 */
@media (min-width: 768px) {
  :root { --nav-w: var(--nav-w-tab); }
  body { font-size: 15.5px; }

  .sidebar { padding: calc(var(--sat) + 14px) 10px calc(var(--sab) + 14px) calc(var(--sal) + 10px); }
  .brand { flex-direction: row; gap: 10px; padding: 6px 8px 14px; justify-content: flex-start; }
  .brand-logo { width: 44px; height: 44px; font-size: 23px; }
  .brand-name { font-size: 14px; text-align: left; line-height: 1.3; }

  .nav-group-title { justify-content: flex-start; font-size: 11.5px; padding: 12px 10px 6px; }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    margin: 3px 0;
  }
  .nav-item .ni-icon { font-size: 18px; }
  .nav-item .ni-text { font-size: 13.5px; }

  .content { padding: 6px 20px calc(var(--sab) + 34px) 18px; }
  .topbar { padding: calc(var(--sat) + 14px) 20px 12px 18px; }
  .tabs { padding: 12px 18px 8px; }
  .tb-title { font-size: 19px; }

  .card { padding: 18px 20px; border-radius: 26px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .calc-ctrl { grid-template-columns: repeat(4, 1fr); }
  .item-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tip-list  { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .calc-result { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
}

/* 大屏 iPad 横屏 / 桌面 */
@media (min-width: 1100px) {
  .content { max-width: 1080px; }
  .item-list, .tip-list, .calc-result { grid-template-columns: repeat(3, 1fr); }
}

/* 降级：不支持 backdrop-filter 时提高不透明度 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sidebar, .card, .topbar { background: rgba(255,255,255,.86); }
}
