:root {
  /* 听觉康复柔和蓝色系 - 平静、宁静、舒缓，适合长时间训练 */
  --bg: #f3f7fb;                    /* 极淡天蓝灰背景，柔和不刺眼 */
  --panel: #ffffff;                 /* 纯白面板 */
  --text: #1c2a3a;                  /* 深蓝灰主文字，温和不死板 */
  --sub-text: #5a6e85;              /* 中性蓝灰副文字 */
  
  /* 主色 - 柔和浅蓝（参考 Tailwind sky/blue 中段，降饱和） */
  --primary: #6b9ac4;               /* 柔和蓝 - 平静专业 */
  --primary-soft: #e3edf7;          /* 浅蓝背景 - 柔和填充 */
  --primary-hover: #547fae;         /* 悬停深一档 */
  
  /* 状态色 - 同样降低饱和，保持温和 */
  --success: #6ba89a;               /* 柔和青绿 - 稳定/成功 */
  --success-soft: #e6f2ee;          /* 浅青绿背景 */
  --warning: #c9a96a;               /* 柔和琥珀 - 注意 */
  --warning-soft: #f6efe1;          /* 浅琥珀背景 */
  --danger: #c08585;                /* 柔和粉红 - 不稳定/危险 */
  --danger-soft: #f5e8e8;           /* 浅粉背景 */
  
  /* 边框与阴影 - 偏蓝灰，柔和层次 */
  --border: #d8e2ed;                /* 蓝灰边框 */
  --border-light: #e8edf3;          /* 更浅蓝灰边框 */
  --shadow-sm: 0 1px 4px rgba(107,154,196,0.10), 0 0 0 1px rgba(107,154,196,0.06);
  --shadow-md: 0 3px 10px rgba(107,154,196,0.14), 0 0 0 1px rgba(107,154,196,0.08);
  --shadow-lg: 0 8px 32px rgba(28,42,58,0.18), 0 1px 6px rgba(28,42,58,0.08);
  
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

/* 通用状态徽章（模块A/B/C/D 训练状态侧栏统一样式）*/
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.74rem;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-0  { background: #f0f3f7; color: #6a7585; }
.badge-0::before  { background: #9fafc0; }
.badge--1 { background: #faf0f0; color: #a06060; }
.badge--1::before { background: var(--danger); }
.badge-1  { background: #eef6f4; color: #4a8878; }
.badge-1::before  { background: var(--success); }

/* 通用图例提示（模块A/B/C/D 共用：颜色说明 未开始(0)/不稳定(-1)/稳定(1)） */
.legend-line {
  font-size: 0.8rem;
  color: var(--sub-text);
  margin-bottom: 8px;
  line-height: 1.5;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 0 4px 0 8px;
  vertical-align: middle;
}
.dot-0 { background: #b8c4d4; }
.dot-1 { background: #d68585; }
.dot1  { background: #6ba89a; }

/* 与模块 A/B 一致的听音按钮（模块 C/D 等复用） */
.learn-speaker-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--primary-soft);
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--primary);
  font-size: 0.82rem;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.learn-speaker-btn:hover:not(:disabled) {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.learn-speaker-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.learn-speaker-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  position: relative;
}
.learn-speaker-icon::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 10px;
  width: 8px;
  height: 10px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 12px -3px 0 -1px #fff, 12px 3px 0 -1px #fff;
}
.learn-speaker-text {
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
}

/* 测试题选项网格与选项按钮（与 pretest / 模块 A 一致，供 D 等页面使用） */
.options-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.opt-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 42px;
  cursor: pointer;
  background: #e8edf3;
  color: #6a6a64;
  font-size: 1rem;
}
.opt-btn.enabled {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-soft);
}
.opt-btn.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.opt-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.opt-media-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  pointer-events: none;
}
.opt-media-img {
  width: 100%;
  max-height: 130px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}
.opt-media-text {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--text);
}

.pretest-global-notice {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid var(--warning, #b8864b);
  border-radius: 10px;
  background: var(--warning-soft, #f5ebe0);
  color: var(--warning, #b8864b);
  font-size: 0.9rem;
  line-height: 1.5;
  font-weight: 500;
}

.pretest-skip-warn {
  margin: 0 0 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #c0392b;
  font-weight: 600;
  text-align: left;
}

.tip {
  font-size: 0.86rem;
  color: var(--sub-text);
  line-height: 1.6;
  margin-top: 0;
}

@media (max-width: 1024px) {
  .options-grid {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 28px 20px 36px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.page { max-width: 1280px; margin: 0 auto; }
/* 与 module-a.css 中模块页顶栏一致（pretest 等使用 main.css 的页面复用） */
.top { margin-bottom: 16px; position: relative; overflow: visible; }

/* 模块页头右上角背景装饰图 */
.mod-header-bg-icon {
  position: absolute;
  right: 8px;
  top: 8px;
  height: calc(100% - 16px);
  width: auto;
  object-fit: contain;
  opacity: 0.09;
  pointer-events: none;
  user-select: none;
}

/* C 模块（声源定位）图标稍微放大 */
.mod-header-bg-icon-c {
  height: calc(100% - 8px);
  top: 4px;
}
/* 返回按钮 - 产品化设计 */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--sub-text);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  transition: all 0.18s ease;
}

.back::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  background: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M12 19l-7-7 7-7'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M12 19l-7-7 7-7'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.back:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.back:active {
  transform: translateY(1px);
}

/* 内部返回按钮 - 产品化设计 */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--sub-text);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-back::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  background: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M12 19l-7-7 7-7'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M12 19l-7-7 7-7'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.btn-back:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn-back:active {
  transform: translateY(1px);
}
.top h1 { font-size: 1.7rem; margin: 8px 0 4px; }
.top p { color: var(--sub-text); font-size: 0.9rem; }
.role-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  color: var(--sub-text);
  font-size: 0.82rem;
}
.role-bar a { color:#546489; text-decoration:none; }
.title-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  margin-bottom: 6px;
}
.title-row-spacer {
  width: 220px;
}
.title-row-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  min-width: 0;
}
.title-row-center .title {
  margin: 0;
}

/* 耳别图标：默认隐藏，由 JS 按选中耳别显示 */
.ear-icon {
  height: 5.25rem;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  display: none;
  pointer-events: none;
  user-select: none;
}
.ear-icon.ear-visible {
  display: block;
}
/* 标题旁：outline 信封 + 右上角未读圆点 */
.btn-msg-envelope {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--sub);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.btn-msg-envelope:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.btn-msg-envelope-icon {
  display: block;
}
.btn-msg-envelope-dot {
  display: none;
  position: absolute;
  right: 6px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 2px var(--panel);
  pointer-events: none;
}
.ear-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.ear-switch-label {
  color: #6b6b65;
  font-size: 0.82rem;
}
.ear-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  padding: 3px;
  gap: 2px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
.ear-btn {
  border: 0;
  background: transparent;
  color: var(--sub-text);
  font-size: 0.82rem;
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.ear-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.ear-btn:not(.active):hover {
  background: rgba(107, 154, 196, 0.14);
  color: var(--primary);
}
.role-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

/* 用户身份标识 - 仿照管理员平台 */
.user-badge-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary);
  user-select: none;
  pointer-events: none;
}

.user-badge-wrapper::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  flex-shrink: 0;
}

.user-role-label {
  display: none;
}

.user-role-badge {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary);
}

/* 设置按钮 - 带文字和图标 */
.btn-settings {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--sub);
}

.btn-settings-icon {
  width: 15px;
  height: 15px;
  object-fit: contain;
  flex-shrink: 0;
  transform: scale(1.5);
  transform-origin: center;
  margin-right: 16px;
  opacity: 0.7;
  transition: opacity 0.18s ease;
}

.btn-settings:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-settings:hover .btn-settings-icon {
  opacity: 1;
}

/* 退出按钮 - 与管理平台保持一致 */
.btn-logout-sm {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--sub);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-logout-sm:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

/* 按钮系统 - 医疗专业风格 */
.btn,
a.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  transition: all 0.18s ease;
}
.btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
button.btn {
  font-family: inherit;
}

/* 主要操作按钮 */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

/* 成功/确认按钮 */
.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover {
  background: #5a9085;
  border-color: #5a9085;
}
.title { 
  text-align: center; 
  font-size: 1.75rem; 
  font-weight: 600; 
  margin-bottom: 0; 
  letter-spacing: 0.02em;
  color: var(--text);
}
.subtitle { text-align: center; color: var(--sub-text); font-size: 0.9rem; margin-bottom: 24px; }
/* 首页：原副标题位置的留白 */
.home-title-tail-spacer {
  font-size: 0.9rem;
  min-height: 1.4em;
  margin-bottom: 24px;
}
.layout-b { display: grid; gap: 14px; grid-template-columns: 2fr 1fr; }
.layout-b > div:first-child,
.layout-b > aside.side-stack {
  min-width: 0;
}
.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(107,154,196,0.10), 0 0 0 1px rgba(107,154,196,0.06);
  padding: 16px;
  transition: box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: 0 3px 10px rgba(107,154,196,0.14), 0 0 0 1px rgba(107,154,196,0.08);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.card-head span { font-size: 0.8rem; font-weight: 500; color: var(--sub-text); }
.trend-tabs { display:flex; gap:6px; }
.trend-tools { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.zoom-tabs { display:flex; gap:6px; }

/* 时段翻页导航 */
.trend-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border-radius: 8px;
  padding: 2px 4px;
}
.trend-nav-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  padding: 0;
}
.trend-nav-btn:hover:not(:disabled) {
  background: var(--primary-soft);
}
.trend-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.trend-nav-label {
  font-size: 0.72rem;
  color: var(--sub-text);
  min-width: 56px;
  text-align: center;
  white-space: nowrap;
  font-weight: 500;
}
.trend-tab {
  background: transparent;
  color: var(--sub-text);
  border-radius: 6px;
  font-size: 0.72rem;
  padding: 4px 12px;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
}
.trend-tab:hover {
  color: var(--primary);
  background: var(--primary-soft);
}
.trend-tab.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
}
.chart-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  height: clamp(200px, 28vh, 280px);
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 0;
  position: relative;
}
.trend-hover-tip {
  position: absolute;
  left: 0;
  top: 0;
  display: none;
  pointer-events: none;
  z-index: 6;
  background: rgba(34, 34, 34, 0.92);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 7px 11px;
  border-radius: 8px;
  max-width: min(280px, 92vw);
  white-space: normal;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
.trend-avg-note {
  position: absolute;
  top: 8px;
  right: 10px;
  left: auto;
  margin: 0;
  padding: 0;
  display: inline-block;
  width: max-content;
  max-width: calc(100% - 20px);
  text-align: right;
  font-size: 0.74rem;
  line-height: 1.2;
  white-space: nowrap;
  color: #3d3d38;
  z-index: 4;
  pointer-events: none;
  background: none;
  border: none;
  box-shadow: none;
}
.chart {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 140px;
  height: 100%;
  max-height: 100%;
  display: block;
  cursor: grab;
  user-select: none;
}
.chart.dragging { cursor: grabbing; }
.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--sub-text);
}
.trend-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 4px 2px;
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  line-height: 1.3;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: transparent;
  border-radius: 4px;
  color: var(--line-color, var(--text));
  transition: opacity 0.15s ease;
}
.trend-legend-item:not(.active) {
  opacity: 0.38;
}
.trend-legend-item.active {
  opacity: 1;
  font-weight: 600;
}
.trend-legend-item:focus-visible {
  outline: 2px solid var(--line-color, var(--primary));
  outline-offset: 2px;
}
.trend-legend-item:focus:not(:focus-visible) {
  outline: none;
}
/* 与曲线同色的小色条（非线框圆点） */
.trend-legend-swatch {
  width: 20px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}
.axis-note {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--sub-text);
  text-align: right;
  margin: 0;
  line-height: 1.4;
}
.axis-note.trend-chart-hint {
  text-align: center;
  font-size: 0.74rem;
}
.modules { display: grid; grid-template-columns: repeat(2, minmax(130px, 1fr)); gap: 10px; align-items: stretch; }
.modules.row { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
.module-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  min-height: 0;
}
.module { border: none; border-radius: var(--radius); padding: 14px; background: #83a0bd; position: relative; overflow: hidden; }
.module-link .module {
  transition: all 0.18s ease;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 模块卡片右上角装饰图 */
.module-deco-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 50%;
  width: auto;
  object-fit: contain;
  opacity: 0.26;
  pointer-events: none;
  user-select: none;
}
.module-link:hover .module { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.module-link .module p {
  flex: 1;
  margin: 0;
}
.icon {
  width: 30px; height: 30px; border-radius: 15px;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-size: 0.9rem; font-weight: 700; margin-bottom: 8px;
}
.module h4 { font-size: 0.92rem; margin-bottom: 4px; }
.module p { font-size: 0.8rem; color: var(--sub-text); line-height: 1.4; }
.calendar-wrap { background: var(--bg); border-radius: var(--radius); padding: 12px; }
.calendar-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.wrong-module-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.wrong-module-filter-label {
  font-size: 0.8rem;
  color: var(--sub-text);
  white-space: nowrap;
}
.wrong-module-filter-select {
  flex: 1;
  min-width: 140px;
  max-width: 100%;
  font-size: 0.82rem;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
.home-unstable-summary {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f0f5fa;
}
.home-unstable-summary-head {
  font-size: 0.72rem;
  color: var(--sub-text);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.home-unstable-summary-body {
  font-size: 0.78rem;
  color: #38465a;
  line-height: 1.55;
}
.home-unstable-summary-body .hus-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  margin-bottom: 4px;
}
.home-unstable-summary-body .hus-line:last-child {
  margin-bottom: 0;
}
.home-unstable-summary-body .hus-mod {
  font-weight: 600;
  color: #2c3a4d;
}
.home-unstable-summary-body .hus-muted {
  color: var(--sub-text);
  font-size: 0.74rem;
}
.year-switch, .month-switch { display: flex; align-items: center; gap: 6px; }
.month-switch { gap: 8px; }
.year-btn, .month-btn {
  width: 24px; height: 24px; border: none; background: transparent; border-radius: 6px;
  color: var(--sub-text); cursor: pointer; line-height: 1;
  transition: background 0.15s;
}
.year-btn:hover, .month-btn:hover { background: var(--primary-soft); color: var(--primary); }
.year-text { font-size: 0.85rem; min-width: 56px; text-align: center; }
.month-text { font-size: 0.85rem; min-width: 40px; text-align: center; }
.week-header { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 8px; color: var(--sub-text); font-size: 0.74rem; text-align: center; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-cell {
  width: 100%; aspect-ratio: 1/1; border-radius: 6px; border: 1px solid transparent; background: var(--border-light);
  font-size: 0.72rem; color: var(--sub-text); display: grid; place-items: center; position: relative;
}
.day-cell.clickable { cursor: pointer; }
.day-cell.empty { background: transparent; border-color: transparent; }
.day-cell.today::after {
  content: ""; position: absolute; top: 2px; right: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); opacity: 0.9;
}
.day-cell.selected { border-color: var(--primary); box-shadow: 0 0 0 1px rgba(107, 154, 196, 0.32); font-weight: 600; }
.lv1 { background: #dde8f4; }
.lv2 { background: #b8d0e7; }
.lv3 { background: #92b6d6; }
.lv4 { background: var(--primary); color: #fff; }
.legend { display: flex; justify-content: flex-end; align-items: center; gap: 6px; color: var(--sub-text); font-size: 0.74rem; margin-top: 10px; }
.legend .day-cell { width: 12px; height: 12px; aspect-ratio: auto; border-radius: 2px; }
.daily-detail { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.detail-title { font-size: 0.84rem; margin-bottom: 8px; color: #38465a; }
.detail-list { list-style: none; display: grid; gap: 4px; max-height: 220px; overflow: auto; }
.detail-list li { background: var(--bg); border-radius: 6px; padding: 6px 8px; font-size: 0.78rem; color: #38465a; }
.detail-list li.detail-line-one {
  padding: 4px 6px;
  font-size: 0.72rem;
}
/* 首页错题日历：单日明细单行（模块 | 距离 | 不稳定；小模块列暂隐藏以适配窄屏） */
.detail-line-one {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  min-height: 26px;
}
.dl-mod {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
}
.dl-mod-main {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: #3a3834;
}
.dl-dist {
  flex: 0 0 auto;
  min-width: 2.5em;
  max-width: 22%;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #38465a;
  padding: 0 2px;
}
.dl-count {
  flex: 0 0 auto;
  min-width: 3.25em;
  max-width: 28%;
  text-align: right;
  font-size: 0.68rem;
  color: rgba(160, 42, 42, 0.92);
  background: rgba(200, 72, 72, 0.14);
  border-radius: 4px;
  padding: 2px 5px;
  line-height: 1.25;
}
.detail-line-fallback {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-line-overflow {
  background: transparent !important;
  border: none !important;
  font-size: 0.72rem;
  color: #6a7585;
  padding: 4px 2px !important;
  white-space: normal;
  line-height: 1.45;
}
.detail-item-mod {
  font-size: 0.72rem;
  color: var(--sub-text);
  margin-bottom: 6px;
}
/* Notion 式属性块（林氏六音题干） */
.ling-notion {
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  background: #f0f5fb;
}
.ling-notion-row {
  display: grid;
  grid-template-columns: 4.75rem minmax(0, 1fr);
  gap: 10px 14px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--border-light);
  align-items: start;
  font-size: 0.8rem;
}
.ling-notion-row:last-child {
  border-bottom: none;
}
.ling-notion-label {
  color: #6b6b68;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  font-weight: 500;
  padding-top: 2px;
  line-height: 1.35;
}
.ling-notion-value {
  color: #2c2822;
  line-height: 1.5;
  word-break: break-word;
}
.ling-notion--inline {
  font-size: 0.76rem;
}
.ling-notion--inline .ling-notion-row {
  padding: 7px 9px;
  grid-template-columns: 4.25rem minmax(0, 1fr);
  font-size: 0.76rem;
}
.ling-notion--inline .ling-notion-label {
  font-size: 0.62rem;
}
.detail-empty { font-size: 0.78rem; color: var(--sub-text); }
.wrong-review-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 8px;
}
.btn-review-open {
  border: 1px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  cursor: pointer;
}
.btn-review-open:hover {
  background: var(--primary-soft);
}
.wrong-review-entry-hint {
  font-size: 0.72rem;
  color: var(--sub-text);
  line-height: 1.4;
}
.side-stack { display: grid; gap: 14px; }
.top-modules { margin-bottom: 14px; }
@media (max-width: 1080px) {
  .title-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .title-row-spacer {
    display: none;
  }
  .title {
    margin-bottom: 2px;
  }
  .layout-b { grid-template-columns: 1fr; }
  .modules.row { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}

.pretest-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.pretest-overlay.show {
  display: flex;
}
.pretest-modal {
  width: min(520px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}
.pretest-modal h2 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}
.pretest-modal p {
  color: var(--sub-text);
  font-size: 0.9rem;
  line-height: 1.5;
}
.pretest-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pretest-btn-primary,
.pretest-btn-secondary {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.9rem;
}
.pretest-btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.pretest-btn-secondary {
  color: #3f3f3f;
}
.pretest-snooze-hint {
  color: var(--sub-text);
  font-size: 0.82rem;
  line-height: 1.5;
  margin-top: 10px;
}
.pretest-snooze-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}
.pretest-snooze-row label {
  color: var(--sub-text);
}
.pretest-snooze-row select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.88rem;
}

/* 训练页回顾模式：由 review-mode-entry.js 插入 */

/* 顶部三栏：左（返回）中（回顾模式）右（占位） */
.review-mode-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  margin-bottom: 12px;
  gap: 8px;
}

/* “返回错题本”左上角 */
.review-mode-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--primary);
  justify-self: start;
}

/* “回顾模式”居中纯文字 */
.review-mode-title-text {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--sub-text);
  letter-spacing: 0.06em;
  text-align: center;
}

/* 右侧占位 */
.review-mode-topbar-spacer {
  justify-self: end;
}

/* ===== 模态弹窗系统 - 产品化设计 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(28,42,58,0.18), 0 1px 6px rgba(28,42,58,0.08);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow: auto;
  animation: modal-slide-in 0.2s ease;
}

@keyframes modal-slide-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--sub-text);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: background 0.18s ease;
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* 表单元素 */
.form-row {
  margin-bottom: 16px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-row-inline {
  display: flex;
  align-items: center;
}

.form-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 154, 196, 0.18);
}

.form-input-short {
  width: 60px;
  text-align: center;
}

.form-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text);
  cursor: pointer;
}

.form-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* 弹窗按钮 */
.btn-primary,
.btn-secondary {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-primary {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg);
  border: none;
  color: var(--sub-text);
}

.btn-secondary:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ── 康复师接入申请卡片 ─────────────────────── */
.tl-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.tl-apply-btn {
  font-size: 0.8rem;
  padding: 5px 12px;
  flex-shrink: 0;
}
.tl-apply-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.tl-empty {
  font-size: 0.82rem;
  color: var(--sub-text);
  margin: 8px 0 0;
  padding: 0;
}
.tl-req-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
/* 单条康复师卡片 */
.tl-therapist-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: #f3f7fb;
}
.tl-therapist-card.tl-approved {
  background: #f3f7fb;
}
.tl-therapist-card.tl-pending {
  background: #f3f7fb;
}
.tl-therapist-card.tl-rejected {
  background: #f3f7fb;
}
/* 头像圆圈 */
.tl-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #e8eef5;
}
.tl-avatar-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
}
/* 信息区 */
.tl-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tl-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}
.tl-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 1px 0 1px 8px;
  border-radius: 0;
  border-left: 2px solid currentColor;
  font-size: 0.75rem;
  font-weight: 500;
  background: none;
}
.tl-status-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  display: none;
}
.tl-approved .tl-status-badge { color: var(--success); }
.tl-pending  .tl-status-badge { color: var(--sub-text); }
.tl-rejected .tl-status-badge { color: var(--danger); }
.tl-date {
  font-size: 0.76rem;
  color: var(--sub-text);
}
.tl-note {
  font-size: 0.76rem;
  color: var(--danger);
  margin-top: 2px;
}
/* 解绑按钮 */
.tl-unlink-btn {
  flex-shrink: 0;
  padding: 5px 12px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--sub-text);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.tl-unlink-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}
