/* 第二版适配层：让 v42dp 全套页面真自适应 5 寸 / 7 寸 / 平板。
   只做「去固定手机壳 + 头栏/底栏常驻 + 内容区内部滚动」，不改任何页面结构与排版。
   此文件在 v42dp 原生 3 个 style 块之后加载，同优先级后者生效。 */
html, body { height: 100%; overflow-x: hidden; }
body {
  margin: 0 !important;
  display: flex !important;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: linear-gradient(180deg, #F2F6FF 0%, #F7F9FC 38%, #F4F6F5 100%) !important;
}

/* 第二版顶栏（在 #root 之外，v42dp 的 render() 不会重绘它） */
.v2bar {
  flex: 0 0 auto; position: relative; z-index: 80;
  background: #12294C; color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 2px 10px rgba(10, 30, 70, .18);
}
.v2bar-in {
  max-width: 900px; margin: 0 auto; padding: 6px 12px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.v2brand { font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.v2brand em {
  font-style: normal; font-size: 10px; font-weight: 600;
  background: #2F6FEB; padding: 1px 6px; border-radius: 20px; margin-left: 4px;
}
.v2bar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.v2bar nav a {
  font-size: 11.5px; color: #C9DCFF; padding: 3px 9px;
  border-radius: 6px; text-decoration: none;
}
.v2bar nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.v2bar nav a.on { background: #2F6FEB; color: #fff; font-weight: 700; }
.v2badge { margin-left: auto; font-size: 10.5px; color: #8FB4F5; white-space: nowrap; }
@media (max-width: 560px) {
  .v2badge { display: none; }
  .v2bar-in { gap: 8px; padding: 5px 8px; }
  .v2bar nav a { padding: 3px 7px; font-size: 11px; }
  /* CR-MOBILE-FULLSCREEN-01（2026-12-04 主人：「一半都是没用的界面，我们只能看到一半的
     员工端，下半部分才是我们的内容展示区域」）——
     手机/企微内置浏览器里只留员工端本体：
     ① #v2bar 是那三条深蓝的「三端入口台」（客户端/员工端/中控台/页面清单/换字清单），整条隐藏
     ② 手机壳去掉边框圆角与留白，内容从屏幕最顶上开始铺满
     ③ 顶部调试条（实时联动/最近联动）由 runtime-17 的 workerBar 在窄屏下自动不渲染 */
  #v2bar, .v2bar { display: none !important; }
  .topbar { display: none !important; }
  /* CR-MOBILE-FULLSCREEN-01：`.ph-sysnav` 是电脑模拟器里画出来的「假系统导航键」（□ ○ ◁），
     真机上手机本来就有真的那排，假的留着既多余又点不动 —— 整块隐藏。 */
  .ph-sysnav, .ph-status { display: none !important; }
  /* 手机上不要把「企微 H5 · 模拟」徽标给阿姨看 —— 那是内部调试标识 */
  .badge-sim { display: none !important; }
  .phone-wrap { padding: 0 !important; margin: 0 !important; max-width: 100% !important; }
  /* CR-MOBILE-LAYOUT-02（2026-12-04 主人：「切换页面时有点抖，2 秒后才清晰」「首页头部还会
     落下来露出底层的字」）——
     根因：上一版给 .phone 加了 min-height:100vh，与原来的 height:min(760px,100vh-96px) 打架，
     内容一撑就开始争高度，于是头部跳、整页抖。手机端改成**严格三段式**：
       ① .phone 固定满屏高度（不设 min-height，避免被内容拉长）
       ② .ph-head 固定不收缩、自带层级，永不离开顶部
       ③ .ph-body 独占剩余空间内部滚动，不带动整页
     100dvh 优先（移动端地址栏收放时不跳），老浏览器回落 100vh。 */
  .phone {
    max-width: 100% !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .ph-head {
    flex: 0 0 auto !important;
    position: relative;
    z-index: 3;
    transform: translateZ(0);
  }
  .ph-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    overflow-anchor: none;
  }
  .ph-tab { flex: 0 0 auto !important; }
  /* CR-KB-FOCUS-01：软键盘弹出时锁死视口高度，防止输入框被挤出屏幕、键盘被连带收起 */
  body.wk-kbopen .phone,
  body.wk-kbopen .phone-wrap {
    height: 100vh !important;
    max-height: 100vh !important;
    min-height: 0 !important;
  }
  body.wk-kbopen .ph-body { overflow-y: auto !important; }
  /* CR-FORM-LAYOUT-02（2026-12-04 主人截图：表单页底部 tab 浮到内容中间变半透明）：
     原因：上一版让表单页 height:auto + overflow:visible，破坏了三段式 flex，
     tab 栏不再被固定在底部。**表单页必须和首页一样三段式**：
     头固定 / 中间滚动 / tab 固定。键盘弹起时不切换高度单位（始终 100dvh），
     靠 .ph-body 内部滚动让输入框始终可见，不靠整页拉伸。 */
  body.wk-form-page .phone {
    height: 100dvh !important;
    max-height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  body.wk-form-page .ph-head { flex: 0 0 auto !important; }
  body.wk-form-page .ph-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  body.wk-form-page .ph-tab {
    flex: 0 0 auto !important;
    position: relative !important;
    z-index: 5;
    background: #fff !important;
    opacity: 1 !important;
  }
  /* 表单页聚焦时不切 100vh（切换会让布局跳、原生控件失焦） */
  body.wk-form-page.wk-kbopen .phone,
  body.wk-form-page.wk-kbopen .phone-wrap {
    height: 100dvh !important;
    max-height: 100dvh !important;
  }
  body { background: #EAEFEC !important; }
}

/* #root 撑满顶栏之外的全部高度 */
#root { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#root > div {
  flex: 1 1 auto; min-height: 0 !important; height: auto !important;
  display: flex !important; flex-direction: column;
  background: transparent !important;
}

/* CR-PHONE-WIDTH-01（2026-11-25 主人）：按真手机宽度显示，宽屏也锁 390px 居中，
   真手机（≤430px）占满视口 —— 调试所见即真机所得。
   旧版这套是「去手机壳 + 720px + 宽屏 8/10 列」，宽屏预览会把客户端拉成 720px、
   宫格变 1×10，跟真手机 5×2 对不上，主人明确要改回真手机宽度。 */
.phone-wrap {
  display: flex !important; flex-direction: column; flex: 1 1 auto; min-height: 0;
  width: 100%; max-width: 390px; margin: 0 auto !important; padding: 0 !important;
  background: transparent; overflow: hidden;
}
.phone {
  display: flex !important; flex-direction: column; flex: 1 1 auto; min-height: 0;
  width: 100% !important; max-width: 390px !important;
  border-radius: 18px; overflow: hidden;
}
.ph-status { display: none !important; }
.ph-head { position: sticky; top: 0; z-index: 30; flex: 0 0 auto; }
.ph-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.ph-tab { position: sticky; bottom: 0; z-index: 30; flex: 0 0 auto; }
.ph-sysnav { flex: 0 0 auto; }

/* 真手机：手机壳占满视口、去掉圆角边框，跟原生小程序一致 */
@media (max-width: 430px) {
  .phone-wrap { max-width: 100% !important; }
  .phone { max-width: 100% !important; border-radius: 0 !important; border: 0 !important; }
}

/* 中控台是网页后台，不走手机壳，保持自身滚动 */
.main { flex: 1 1 auto; min-height: 0; }

/* CR-PHONE-WIDTH-01：宫格不再按「视口宽度」展开。手机壳锁 390 后视口再宽也是手机视图，
   保留客户端自身的 5 列（grid10 = 5×2）/ 4 列规则，跟真手机一致。 */

/* CR-HERO-FULL-01：详情主图满铺。
   桌面宽屏下原 .svc-hero{max-height:40vh} 会按 3:2 反推宽度，把图压成半边；
   宽度锁 100% + 高度交给 aspect-ratio，桌面/手机都满铺，手机端表现不变。 */
.svc-hero {
  width: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  aspect-ratio: 3 / 2 !important;
}
