/* ============================================================
   mobile.z01.css — 手机端（≤899px）通用修补
   桌面一律不动，只补手机上确实不好用的地方。
   引入位置：紧跟 detail.z01.css 之后。
   ============================================================ */

@media (max-width: 899px) {

  /* ---------- 1. AI 接入设置：按钮被挤出屏幕 ----------
     容器 .cw-actions 是 flex + nowrap，「填入内置规范全文」按 flex:1 占满整行，
     后面「清空规范（恢复内置，不动三件套）」带着内联 flex:0 0 auto、
     内容宽 238px，被推到屏幕外（right 421 > 视口 390），文字直接被裁。
     放开换行即可：第一行占满，第二行自己一行。 */
  .cw-actions {
    flex-wrap: wrap !important;
  }

  /* ---------- 2. 页脚协议链接热区太小 ----------
     用户协议 / 隐私政策 / 备案号 只有 16px 高（一行文字），
     手指点下去经常点空。用 padding 把热区撑到 40px，
     再用同样的负 margin 把视觉位置拉回去，页脚整体高度不变。 */
  #ctmLegalFooter a {
    display: inline-block;
    padding: 12px 7px;
    margin: -12px -7px;
  }

  /* ---------- 3. 集采药品详情：手机上是一段裸结构 ----------
     它是 #view 直接子元素（h2 / .lead / .kv / .sec-title / .note），
     没有 .detail-card 包裹，桌面靠 pc.z01.js 打的 .jc-detail 补白卡，
     但那条规则写在 min-width:900 里，手机上就变成灰底裸奔，
     和药品、医疗文书详情页的白卡风格对不上。
     这里把内容块拼成一张连续白卡（按钮和页脚留在卡外）。 */
  #view.jc-detail > h2,
  #view.jc-detail > .lead,
  #view.jc-detail > .kv,
  #view.jc-detail > .sec-title,
  #view.jc-detail > .note {
    background: #fff;
    margin-left: 12px;
    margin-right: 12px;
  }
  #view.jc-detail > h2 {
    margin-top: 0;
    margin-bottom: 0;
    padding: 18px 16px 2px;
    border-radius: 14px 14px 0 0;
    font-size: calc(19px * var(--fs, 1));
    line-height: 1.4;
  }
  #view.jc-detail > .lead {
    margin-top: 0;
    margin-bottom: 0;
    padding: 4px 16px 12px;
    font-size: calc(12.5px * var(--fs, 1));
  }
  #view.jc-detail > .kv {
    margin-top: 0;
    margin-bottom: 0;
    padding: 9px 16px;
  }
  #view.jc-detail > .sec-title {
    margin-top: 0;
    margin-bottom: 0;
    padding: 13px 16px 3px;
    border-radius: 14px 14px 0 0;
  }
  /* 「中选企业」前面本来就有 12px 间距，正好当作两张卡片的间隔：
     上块收下圆角、下块起上圆角，看起来是两张干净的卡而不是被切断。
     老浏览器不支持 :has 时只是少个圆角，不会破版。 */
  #view.jc-detail > .kv:has(+ .sec-title) {
    border-radius: 0 0 14px 14px;
  }
  #view.jc-detail > .note {
    margin-top: 0;
    margin-bottom: 12px;
    padding: 12px 16px 16px;
    border-radius: 0 0 14px 14px;
  }

  /* 暗色配套 */
  html[data-theme="dark"] #view.jc-detail > h2,
  html[data-theme="dark"] #view.jc-detail > .lead,
  html[data-theme="dark"] #view.jc-detail > .kv,
  html[data-theme="dark"] #view.jc-detail > .sec-title,
  html[data-theme="dark"] #view.jc-detail > .note {
    background: #141a22;
  }
}

/* ===========================================================
   4. 健康管理（家庭健康管理）四宫格对齐
   症状：字号调到 A+ 后「病案+图片资料」这 7 个字折成两行，
   卡片又是 justify-content:center 居中，于是同一排两张卡的
   图标、标题、「未记录」三行全部错位，看着像卡片高低不齐。
   做法：内容从顶部起排 + 标题预留两行高度（单行标题在框内垂直
   居中），这样折行与否都不影响下一行「未记录」的位置。
   =========================================================== */
@media (max-width: 899px) {
  .hm-grid-card {
    justify-content: flex-start;
    padding: 15px 8px 13px;
  }

  .hm-grid-card .hm-grid-ico {
    margin-bottom: 7px;
  }

  .hm-grid-card .hm-grid-t {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 2.6em;          /* 2 行 × line-height 1.3，长标题折行也不顶乱下面 */
    text-align: center;
    overflow-wrap: break-word;
  }

  .hm-grid-card .hm-grid-s {
    margin-top: 2px;
  }

  /* 体检入口按钮：字号放大后别被 nowrap 截断，允许折行 */
  #hmCheckup {
    white-space: normal;
    line-height: 1.4;
    text-align: center;
  }

  /* 窄屏（≤380，含 327/360 这类小屏安卓）按钮文字会顶成两行、只剩一个「查」字，
     压一点字号 + 内边距保证单行 */
  @media (max-width: 380px) {
    #hmCheckup {
      padding-left: 8px !important;
      padding-right: 8px !important;
      font-size: 13.5px !important;
      letter-spacing: -.2px;
    }
  }

  /* 成员条 / 档案卡在窄屏 + 大字号下别把「编辑/删除成员」挤出屏幕 */
  #hmProfile {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  #hmProfile .phm-card-main {
    min-width: 0;
    flex: 1 1 140px;
  }
}
