/* =============================================================
   TCWP PC 版布局层（仅 html.pc-mode 生效，完全不影响手机版）
   进入方式：桌面任务「中医工具」内置窗口加载 index.html?pc=1
   设计依据：TCWP_电脑版原型.html (v3.2) / TCWP_电脑版执行计划.md §2.5 / §2.6 / §六
   布局：左侧栏导航（白色简洁）+ 顶部工具条 + 内容区（典经阁主从双栏 / 工作台双列）
   ============================================================= */
html.pc-mode { --pc-side-w: 204px; }   /* 需求7：较 226px 缩窄约 10% */

/* ───────────── 左侧导航栏（白色 · 简洁清爽，需求7）───────────── */
#pcSidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--pc-side-w);
  background: #ffffff;
  color: #2a3642;
  display: flex; flex-direction: column;
  z-index: 60;
  padding: 14px 12px;
  box-sizing: border-box;
  overflow-y: auto;
  border-right: 1px solid #e6ebf1;
  box-shadow: 2px 0 14px rgba(20, 40, 70, .06);
}
#pcSidebar .pc-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
/* 需求3（2026-10-06）：左上角改为中医问诊桌面图标（与手机端 PWA 图标一致），
   取消原蓝色渐变底与 SVG 线条样式，直接显示图标本身。 */
#pcSidebar .pc-brand .lg {
  width: 34px; height: 34px; border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(26,42,58,.18);
}
#pcSidebar .pc-brand .lg svg { width: 20px; height: 20px; display: block; }
#pcSidebar .pc-brand b { font-size: 15px; line-height: 1.2; color: #1c2733; }
#pcSidebar .pc-brand small { display: block; font-size: 11px; color: #8a97a5; margin-top: 2px; }
.pc-nav { display: flex; flex-direction: column; gap: 3px; }
.pc-nav-grp { font-size: 10.5px; letter-spacing: .6px; color: #9aa7b4; margin: 14px 8px 5px; font-weight: 700; }
.pc-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px; color: #3a4a59;
  font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, color .15s;
  user-select: none;
}
.pc-nav a .ic { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; display: flex; align-items: center; justify-content: center; height: 20px; }
/* 【v368】侧栏图标 = 手机版底部栏同款图（pc.js 从 #tabbar 读取） */
.pc-nav a .ic-img { width: 18px; height: 18px; object-fit: contain; display: block; pointer-events: none; }
.pc-nav a.active .ic { background: rgba(255,255,255,.95); border-radius: 7px; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.pc-nav a:hover { background: #f0f4f8; color: #1c2733; }
.pc-nav a.active {
  background: linear-gradient(90deg, #2E7CC4, #185FA5); color: #fff;
  box-shadow: 0 4px 14px rgba(24, 95, 165, .4);
}
/* 【v346】原「复用」角标（.pc-nav a .lk）已按用户要求移除 */
#pcSidebar .pc-foot { margin-top: auto; padding: 10px 8px 2px; font-size: 11px; color: #9aa7b4; line-height: 1.5; }

/* ───────────── 顶栏 / 内容区让出左侧栏 ───────────── */
html.pc-mode .app-bar { left: var(--pc-side-w); right: 0; }
html.pc-mode .view   { left: var(--pc-side-w); right: 0; bottom: 0; padding: 0; }
html.pc-mode #acuHost { left: var(--pc-side-w); right: 0; bottom: 0; }
html.pc-mode .tabbar { display: none !important; }
html.pc-mode #bootSplash { left: var(--pc-side-w); }
html.pc-mode .app-bar__title { font-size: 18px; }

/* ───────────── 内容区通用 ───────────── */
html.pc-mode .section { padding: 20px 26px 34px; max-width: 1320px; }
html.pc-mode .view::-webkit-scrollbar { width: 8px; }
html.pc-mode .view::-webkit-scrollbar-thumb { background: rgba(24, 95, 165, .18); border-radius: 8px; }

/* 【v370】典经阁整体上移：搜索框到台头(app-bar)的间隙 == 搜索框到下方模块切换按钮(.q-tabs)的间隙。
   实测(PC 1600×950)：改前 gapAbove=28px / gapBelow=8px。
   做法：① .section 顶部内边距 20→8，令 #qSearchWrap 上移到台头下方 16px；
        ② .q-header 内 .q-searchwrap 的下外边距 8→16，令搜索框到 .q-tabs 也是 16px。
        两处相消后上下间隙均为 16px，视觉完全对称。仅 PC 生效，手机零侵入。 */
html.pc-mode .q-view { padding-top: 8px; }
html.pc-mode .q-view .q-header { padding-top: 8px; }
html.pc-mode .q-view .q-searchwrap { margin-bottom: 16px; }

/* ───────────── 双栏网格助手 ───────────── */
html.pc-mode .pc-grid2 { display: grid; grid-template-columns: minmax(340px, 420px) 1fr; gap: 18px; align-items: start; }
html.pc-mode .pc-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }
html.pc-mode .pc-col { min-width: 0; }
html.pc-mode .pc-detail {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 20px; min-height: 320px; box-sizing: border-box;
}
html.pc-mode .pc-detail .empty { color: var(--text-muted, #8a97a5); text-align: center; padding: 60px 20px; }
html.pc-mode .pc-detail h3 { margin: 0 0 12px; font-size: 18px; }
html.pc-mode .pc-detail .pc-note { font-size: 12px; line-height: 1.7; color: #6b7785; }

/* ───────────── 工作台 ───────────── */
html.pc-mode .wb-section { display: flex; flex-direction: column; }
html.pc-mode .wb-sticky {
  position: static !important;
  box-shadow: none !important;
  background: transparent;
  padding: 0 0 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  z-index: auto;
}
html.pc-mode .wb-sticky .toolbar { margin-bottom: 10px; }

/* 【v346】工作台顶部统计卡：PC 一排 6 个平均排布（病例数/本月新增/复诊数/有效率/治愈率/复诊率） */
html.pc-mode #wbStats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
html.pc-mode #wbStats .stat { padding: 12px 8px; border-radius: 10px; }
html.pc-mode #wbStats .stat .num { font-size: 22px; }
html.pc-mode #wbStats .stat .lbl { font-size: 11.5px; margin-top: 3px; white-space: nowrap; }

/* 【v346】PC 隐藏「排序：全部·待审批→…」说明行 */
html.pc-mode .wb-sort-hint { display: none !important; }
/* 【v347】工作台卡片：PC 下两列自适应网格 */
html.pc-mode #wbList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
  gap: 14px;
  align-items: start;
}
html.pc-mode #wbList > .empty { grid-column: 1 / -1; }

/* ───────────── 典经阁：左列表 + 右详情面板（需求 3/4/5/6）───────────── */
html.pc-mode .pc-dj-grid { display: grid; gap: 18px; align-items: start; }
html.pc-mode .pc-dj-grid.dj-rail-hidden { grid-template-columns: 1fr; }          /* orig / 医案A：全宽，无右栏 */
html.pc-mode .pc-dj-grid.dj-mode-split   { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } /* 方剂/药物/医案：左列表(目录) + 右详情，左右等宽 */
html.pc-mode .pc-dj-grid #qBody { margin-top: 0 !important; min-width: 0; }
html.pc-mode .pc-dj-grid.dj-mode-split #qBody,
html.pc-mode .pc-dj-grid.dj-rail-hidden #qBody { max-height: calc(100vh - 150px); overflow-y: auto; }

/* 需求3：典籍三列（伤寒论 / 金匮要略 / 康平本伤寒论；刘希彦解读并入对应典籍列）
   由 pc.js 把 .q-book 节点搬进 3 个 .pc-dj-col 容器，这里只负责分列排版。 */
html.pc-mode #qBody.dj-orig-double {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
html.pc-mode #qBody.dj-orig-double .pc-dj-col { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
html.pc-mode #qBody.dj-orig-double .pc-dj-col:empty { display: none; }
/* 刘希彦解读块在 PC 下并入同书列：去掉额外上边距，视觉上从属于该典籍 */
html.pc-mode #qBody.dj-orig-double .q-book[data-pc-group="liu"] { margin-top: 0 !important; }
html.pc-mode #qBody.dj-orig-double .q-book[data-pc-group="liu"] .q-book__title { opacity: .92; }
/* 单列时（未开启三列）不做任何搬移，天然就是原来的纵向流 */
html.pc-mode #qBody:not(.dj-orig-double) .pc-dj-col { display: contents; }

/* 医案 PC 下恒为左目录 + 右详情（dj-mode-split），不再有「双列弹窗」模式，故移除 dj-case-2col。 */

/* 右详情面板（替代弹窗） */
#djDetailPC {
  background: #fff; border: 1px solid #e6ebf1; border-radius: 14px;
  padding: 14px 16px; box-sizing: border-box;
  max-height: calc(100vh - 150px); overflow-y: auto;
}
#djDetailPC.dj-rail-hidden { display: none !important; }
#djDetailPC .dj-detail-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #eef2f6;
}
#djDetailPC .dj-detail-hd span { font-size: 14px; font-weight: 700; color: #1c2733; }
#djDetailPC .dj-detail-close {
  border: 0; background: #f0f4f8; color: #5a6b7a; width: 26px; height: 26px;
  border-radius: 8px; cursor: pointer; font-size: 13px; line-height: 1;
}
#djDetailPC .dj-detail-close:hover { background: #e3eaf1; }
#djDetailPC .dj-detail-body { min-height: 200px; }
#djDetailPC .dj-detail-body .empty { color: #8a97a5; text-align: center; padding: 60px 20px; }
/* 中和被提升 modal 的卡片样式，使其在面板内铺满 */
html.pc-mode #djDetailPC .tcwp-modal {
  max-width: none; width: 100%; box-shadow: none; background: transparent;
  border: 0; padding: 0; animation: none;
}
/* 面板自带关闭按钮，隐藏原 modal 内的「关闭」 */
html.pc-mode #djDetailPC .tcwp-modal__close { display: none !important; }

/* 【需求4·2026-10-06】章节头吸顶修复：PC 版之前"固定在中间"、现改为真正吸顶。
   根因：#qHeader（搜索栏+子tab）与 #qBody 是兄弟节点；PC 下真正滚动的是 #qBody
   （overflow-y:auto，max-height:calc(100vh-150px)），而手机版滚动的是视口。
   app.css 的 .q-ch.open .q-ch__head.sticky 用的是 top: var(--q-header-h)（≈110px），
   那是按"视口滚动 + 头部占位"设计的；到了 PC，参照系变成 #qBody 自身，
   于是章节头被顶到滚动区内部 110px 处 → 视觉上"卡在中间"。
   v353 曾用 position:static !important 试图绕过，结果把吸顶功能整个关掉了。
   正确做法：PC 下恢复 position:sticky，并令 top:0 —— 即贴 #qBody 滚动区顶部，
   下一个章节滚上来时自然把上一个顶走（与手机版一致的语义）。 */
html.pc-mode .q-ch.open .q-ch__head.sticky {
  position: sticky !important;
  top: 0 !important;              /* 参照系是 #qBody 滚动区，非视口 → 不加 header 高度 */
  z-index: 12;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 14px -10px rgba(24, 95, 165, .4);
}
/* 吸顶时铺满所在列宽，避免圆角/阴影在列间露出缝 */
html.pc-mode .q-ch.open .q-ch__head.sticky { margin: -1px -1px 0; border-radius: var(--radius) var(--radius) 0 0; }

/* ───────────── 典经阁：右侧字母锚点条（v410）─────────────
   坑（同 v353 章节头）：.q-recipe__alpha / .q-herb__alpha 的 position:sticky
   top 用的是 var(--q-header-h)(≈110px)，那是按"视口滚动 + 头部占位"设计的；
   到 PC 双栏后参照系变成 #qBody 自身 → 字母条会被顶到滚动区内部 110px 处，
   视觉上"悬在中间"且遮挡内容。PC 下改为贴 #qBody 滚动区顶部 top:0。 */
html.pc-mode .q-recipe__alpha,
html.pc-mode .q-herb__alpha {
  top: 0 !important;
  max-height: calc(100vh - 170px);
  z-index: 11;
}

/* ───────────── 经络穴位：iframe 占满内容区 ───────────── */
html.pc-mode #acuHost { background: #eaf0f6; }

/* ───────────── 设置：台头图（v359 起 PC 端显示，作为「更换台头图片」的入口）───────────── */
/* 说明：v351 曾在此隐藏台头，因当时设置页另有「外观-更换台头图片」行；
   v359 移除该板块后台头图成为唯一入口，故 PC 端恢复显示。 */
/* 【v367】设置页双列：工具类（5 项）置右列上方，关于置右列下方，
   其余（海报/后端/账户）置左列。
   关键：DOM 顺序完全不变（手机版定稿严禁改动），仅 PC 用 CSS Grid 显式 grid-area
   定位，手机版因不命中 html.pc-mode 选择器而保持单列纵向流。
   v367b：覆盖 app.css 的 .setting-group{margin-bottom:22px}，改由 grid 行距统一控制，
   把大板块间距从 ~38px 收到 12px。 */
html.pc-mode .setting-group { margin-bottom: 0; }
html.pc-mode .section--settings {
  display: grid;
  /* 「平均分配」：两栏等宽（1fr 1fr），消除原先 1.12fr/0.88fr 的不均；
     max-width 由 1080 → 1240，令两栏真正吃掉内容区宽度、右侧不再留大片空白。 */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "poster  tools"
    "backend tools"
    "account about";
  gap: 12px 22px;
  align-items: start;
  max-width: 1240px;
}
html.pc-mode .sg-poster  { grid-area: poster; }
html.pc-mode .sg-backend { grid-area: backend; }
html.pc-mode .sg-tools   { grid-area: tools; align-self: stretch; }
html.pc-mode .sg-account { grid-area: account; }
html.pc-mode .sg-about   { grid-area: about; }

html.pc-mode .section#settingsWrap,
html.pc-mode .pc-settings-wrap { max-width: 880px; }

/* v365：电脑版设置页不再显示「台头图」入口（该入口仅手机版保留）。
   JS 渲染层已对 PC 跳过；此处加 CSS 兜底，防止任何其它路径误显。 */
html.pc-mode .about-hero-sticky { display: none !important; }

/* ═════════════ 编辑器内嵌（需求2·2026-10-06，仅 PC）═════════════
   目标：点左侧栏「编辑器」后，编辑器原页面内容直接呈现在主界面左半区，
        不再新开窗口/整页跳走；右侧保留主界面区，便于对照查看。
   实现：#pcEduHost 为 iframe 宿主，与 #view / #acuHost 同级，
        靠 JS 显示/隐藏切换（.view 已带 left/right/bottom 定位）。 */
html.pc-mode #pcEduHost {
  left: var(--pc-side-w);
  right: 0;                      /* 编辑器占满内容区（原页面内容完整呈现，不留空隙） */
  top: 0;                          /* 编辑器自带标题栏，隐藏主台头后从顶部起 */
  bottom: 0;
  background: #f5f7fa;
  z-index: 5;
}
html.pc-mode #pcEduHost iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
/* 编辑器打开时主界面视图让位（pc.js 已同步隐藏，这里兜底防闪现） */
html.pc-mode #pcEduHost:not([style*="display: none"]) ~ #view,
html.pc-mode #pcEduHost:not([style*="display: none"]) ~ #acuHost { display: none !important; }

/* 需求4（2026-10-06）：左下角后端标注——主数据加粗、备用数据次级，切换后实时同步 */
#pcSidebar .pc-foot #pcBackend { color: #6b7a8a; line-height: 1.6; }
#pcSidebar .pc-foot #pcBackend b { color: #1c2733; font-weight: 700; }

/* ══════════════ 研学苑 · PC 专属优化（v412）══════════════
   1) 首屏 hero 紧凑化：原手机版大卡（46px 数字 + 整行按钮）在 PC 宽屏上占掉近半屏，
      纵向空间被浪费。PC 下改为「左信息 + 右操作」的横向条，高度压到约 1/3。
   2) 工具组上移（顺序变更在 learn.js showHome 内按 html.pc-mode 判断），
      并把三张工具卡改为等宽横排，占用更少纵向空间。
   3) 14 天负载图新增结论行样式（.learn-fc-sum）。
   ※ 全部用 html.pc-mode 限定，手机版与网页版零影响。 */
html.pc-mode .learn { max-width: 1180px; }

/* —— 首屏 hero 紧凑横条 —— */
html.pc-mode .learn-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 14px 20px;
    border-radius: 14px;
}
html.pc-mode .learn-hero::after { font-size: 84px; bottom: -26px; right: 120px; }
html.pc-mode .learn-hero .lh-info { min-width: 0; }
html.pc-mode .learn-hero .lh-eyebrow { font-size: 11.5px; }
html.pc-mode .learn-hero .lh-due { font-size: 30px; margin: 2px 0 1px; }
html.pc-mode .learn-hero .lh-due small { font-size: 13px; margin-left: 5px; }
html.pc-mode .learn-hero .lh-sub { font-size: 12px; }
html.pc-mode .learn-hero .lh-actions {
    margin-top: 0;
    align-items: center;
    gap: 8px;
}
html.pc-mode .learn-hero .btn-start { min-width: 132px; padding: 10px 22px; }
html.pc-mode .learn-hero .btn-ghost2 { padding: 10px 16px; }

/* —— 工具组：PC 下三卡横排 —— */
html.pc-mode .learn-tools > .lb-title { margin-bottom: 8px; }
html.pc-mode .learn-tools .learn-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
html.pc-mode .learn-tools .learn-row { margin-bottom: 0; }
html.pc-mode .learn-tools .lro-main { min-width: 0; }
html.pc-mode .learn-tools .lro-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* —— 14 天负载图结论行 —— */
html.pc-mode .learn-fc-sum,
.learn-fc-sum {
    display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
    margin-top: 8px; font-size: 12.5px; color: var(--text-muted);
}
.learn-fc-sum b { color: var(--text); font-weight: 800; }
.learn-fc-sum .warn { color: var(--due, #c0392b); font-weight: 700; }

/* —— 负载柱超上限标记 —— */
.learn-forecast .lf-bar.over { box-shadow: 0 0 0 2px var(--due, #c0392b); border-radius: 3px; }

/* ══════════════ 设置页 · PC 专属排版优化（v412）══════════════
   原布局：4 个分组纵向长条（标题 + 若干行），在 PC 宽屏上左右留白巨大、行距松散、
   卡片间无视觉分组，读起来散。
   改法（仅 PC）：
   ① 整页最大宽度收窄 + 内容居中，避免超宽屏下行长过长；
   ② 四个分组改为「两列卡片网格」，卡片带浅底与圆角，组内标题与行对齐统一；
   ③ 分组标题加左侧色条强化层级；行高与图标尺寸微调，整页节奏一致；
   ④ 「数据后端」这类内容较多的组允许跨列（grid-column: span 2），
      避免两列高度失衡出现大片空白。
   ※ 全部 html.pc-mode 限定，手机版与网页版零影响。 */
html.pc-mode .section--settings {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 24px 40px;
}
html.pc-mode .section--settings .setting-group {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px 18px 14px;
    margin-bottom: 16px;
    box-shadow: 0 6px 18px -14px rgba(24, 95, 165, .35);
}
html.pc-mode .section--settings .setting-group__title {
    position: relative;
    padding-left: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    letter-spacing: .5px;
}
html.pc-mode .section--settings .setting-group__title::before {
    content: "";
    position: absolute; left: 0; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 15px; border-radius: 3px;
    background: var(--brand-2);
}
html.pc-mode .section--settings .setting-row {
    padding: 13px 14px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--line);
}
html.pc-mode .section--settings .setting-row:last-child { margin-bottom: 0; }
html.pc-mode .section--settings .setting-row .label { font-size: 14.5px; }
html.pc-mode .section--settings .setting-row .label .ico { font-size: 17px; }
html.pc-mode .section--settings .setting-row .val { font-size: 13.5px; }
html.pc-mode .section--settings .setting-row[style*="display:block"] {
    background: transparent; border: none; padding: 0;
}
html.pc-mode .section--settings .segment { max-width: 420px; }
html.pc-mode .section--settings .setting-group .help { font-size: 12.5px; line-height: 1.6; }

/* —— 设置页分组：PC 下两列卡片网格（用 Grid 自动排布，不改 HTML 结构）——
   ① 「数据后端」组内容较多，跨两列，避免两列高度失衡；
   ② 「关于」组通常较短，可与「账户」并列；
   ③ 单列时（窄屏回退）自动回到纵向堆叠。 */
html.pc-mode .section--settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}
html.pc-mode .section--settings > .setting-group { margin-bottom: 0; }
html.pc-mode .section--settings > .sg-backend { grid-column: 1 / -1; }
html.pc-mode .section--settings > .sg-poster { grid-column: 1 / -1; }
html.pc-mode .section--settings > *:not(.setting-group) { grid-column: 1 / -1; }
@media (max-width: 900px) {
    html.pc-mode .section--settings { grid-template-columns: 1fr; }
}
