/* H5 移动端壳样式 */
body.h5 { overscroll-behavior-y: none; }
body.h5 .layout { grid-template-columns: 1fr !important; }
body.h5 .sidebar { display: none !important; }
body.h5 [data-act="toggle-side"] { display: none !important; }
body.h5 .topbar { position: sticky; top: 0; z-index: 30; padding: 8px 12px; }
body.h5 .crumb { display: none; }            /* 手机上页面内已有标题，顶栏位置让给企业标识 */
body.h5 .t-div { display: none; }
body.h5 .t-co { font-size: 13px; max-width: 120px; }
body.h5 .tbar-id { gap: 7px; }
body.h5 .topbar .user-chip .rl { display: none; }
body.h5 #page { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
body.h5 .h5-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 200; display: flex; background: rgba(255,255,255,.97); backdrop-filter: blur(10px); border-top: 1px solid #E8ECF2; padding-bottom: env(safe-area-inset-bottom); }
.h5-tab { flex: 1; border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0 6px; font-size: 10.5px; color: #8A97AB; position: relative; cursor: pointer; }
.h5-tab .i { font-size: 19px; line-height: 1.15; }
.h5-tab.on { color: #2563EB; font-weight: 600; }
.h5-tab .bdg { position: absolute; top: 3px; right: calc(50% - 20px); background: #DC2626; color: #fff; border-radius: 9px; font-size: 9.5px; padding: 0 4.5px; min-width: 15px; height: 15px; line-height: 15px; font-style: normal; }

/* 登录页 */
.h5-login { position: fixed; inset: 0; z-index: 500; background: linear-gradient(160deg, #0E1729 0%, #16233F 58%, #1D2F55 100%); display: flex; align-items: center; justify-content: center; padding: 26px 22px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.h5-login[hidden] { display: none; }
.hl-card { width: 100%; max-width: 380px; }
.hl-logo { width: 58px; height: 58px; border-radius: 16px; background: linear-gradient(135deg, #2563EB, #7C3AED); color: #fff; font-size: 26px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.hl-t { color: #fff; font-size: 24px; font-weight: 700; }
.hl-s { color: #93A3BE; font-size: 13px; margin: 5px 0 26px; }
.hl-field { margin-bottom: 13px; }
.hl-field input { width: 100%; box-sizing: border-box; border: 1px solid #2C3D5F; background: rgba(255,255,255,.06); border-radius: 12px; padding: 13px 15px; color: #fff; font-size: 16px; outline: none; }
.hl-field input::placeholder { color: #5D6E8A; }
.hl-field input:focus { border-color: #3B82F6; }
.hl-btn { width: 100%; border: none; border-radius: 12px; background: linear-gradient(135deg, #2563EB, #4F46E5); color: #fff; font-size: 16px; font-weight: 600; padding: 13px; margin-top: 4px; cursor: pointer; }
.hl-btn:active { transform: scale(.98); }
.hl-msg { color: #F87171; font-size: 12.5px; min-height: 18px; margin-top: 9px; }
.hl-mini { border: 1px solid #2C3D5F; background: rgba(255,255,255,.08); color: #C7D6EE; font-size: 12.5px; border-radius: 10px; padding: 0 12px; height: 46px; flex: none; cursor: pointer; white-space: nowrap; }
.hl-mini:disabled { opacity: .55; }
.hl-modes { margin-top: 10px; text-align: center; }
.hl-modes button { border: none; background: none; color: #7E93B8; font-size: 12.5px; cursor: pointer; padding: 4px 6px; }
.hl-modes button:active { color: #C7D6EE; }
.hl-or { display: flex; align-items: center; gap: 10px; margin: 14px 0 12px; }
.hl-or i { flex: 1; height: 1px; background: rgba(255,255,255,.1); }
.hl-or span { color: #5D6E8A; font-size: 11.5px; }
.hl-wx { background: linear-gradient(135deg, #16A34A, #22C55E) !important; display: flex; align-items: center; justify-content: center; gap: 7px; }
.hl-wx-tip { margin-top: 10px; color: #86EFAC; font-size: 12px; line-height: 1.7; background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.28); border-radius: 10px; padding: 9px 11px; }
.hl-pc { display: block; margin-top: 16px; text-align: center; color: #6E82A6; font-size: 12px; text-decoration: none; }
.hl-pc:active { color: #A9BBD8; }
.hl-demo { margin-top: 22px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 13px 14px; display: flex; flex-direction: column; gap: 9px; }
.hl-demo b { color: #93A3BE; font-size: 11.5px; font-weight: 600; }
.hl-demo span { color: #D7E1F2; font-size: 13px; padding: 7px 10px; background: rgba(255,255,255,.05); border-radius: 8px; cursor: pointer; }
.hl-demo span:active { background: rgba(255,255,255,.12); }
body.h5-logged-out .layout { display: none; }

/* 超窄屏下的页面细节 */
@media (max-width: 480px) {
  body.h5 .page { padding: 12px 12px 0; }
  body.h5 .page-hd h2 { font-size: 18px; }
  body.h5 .topbar { padding: 8px 10px; }
}

/* ---------------- 首页应用宫格 ---------------- */
#h5-grid { padding: 10px 12px 2px; display: flex; flex-direction: column; gap: 12px; }
.h5-grid-sec { background: #fff; border: 1px solid #E8ECF2; border-radius: 14px; padding: 12px 10px 8px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.h5-grid-t { font-size: 11.5px; color: #8A97AB; font-weight: 600; letter-spacing: .04em; margin: 0 4px 8px; }
.h5-grid-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 2px; }
.h5-gi { border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 2px; cursor: pointer; position: relative; }
.h5-gi:active { transform: scale(.94); }
.h5-gi .gi-ico { width: 44px; height: 44px; border-radius: 13px; background: #F1F5FB; display: flex; align-items: center; justify-content: center; font-size: 21px; }
.h5-gi .qi { background: linear-gradient(135deg, #EAF1FE, #F3EEFD); }
.h5-gi .gi-n { font-size: 11px; color: #33415C; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h5-gi .bdg { position: absolute; top: 0; right: calc(50% - 26px); background: #DC2626; color: #fff; border-radius: 9px; font-size: 9.5px; padding: 0 4.5px; min-width: 15px; height: 15px; line-height: 15px; font-style: normal; }

/* ---------------- 子页面返回条 ----------------
   每个页面顶部常驻：sticky 紧贴顶栏之下（--h5-toph 由 h5.js 按顶栏实测高度写入） */
.h5-backbar { position: sticky; top: var(--h5-toph, 0px); z-index: 25; display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 0; background: rgba(246,248,252,.97); backdrop-filter: blur(8px); border-bottom: 1px solid #E8ECF2; }
.h5-back { border: 1px solid #DDE3ED; background: #fff; color: #2563EB; font-size: 12.5px; font-weight: 600; border-radius: 9px; padding: 5px 11px; cursor: pointer; flex: none; }
.h5-back:active { transform: scale(.96); }
.h5-back-t { font-size: 12.5px; color: #64748B; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h5-tabbar[hidden]{ display:none !important; }
body.h5 .m-tabbar { display:none !important; }   /* 旧的移动增强层底部导航与新 H5 壳互斥，避免双层叠加 */

/* ---------------- 即时消息（聊天）移动端布局 ----------------
   手机上会话列表压缩、消息区占据剩余高度，输入条始终可见；
   键盘弹出时由 h5.js 写入 --kbh（键盘高度），同步收缩高度并隐藏底部页签 */
:root { --kbh: 0px; --h5-toph: 0px; --h5-bbh: 0px; }
body.h5 .chat-grid { display: flex !important; flex-direction: column; height: calc(100dvh - 216px - var(--kbh, 0px) - var(--h5-bbh, 0px)); min-height: 330px; gap: 10px !important; }
body.h5 .chat-list-card { flex: none; max-height: 24vh !important; }
body.h5 .chat-thread-card { flex: 1; min-height: 0; max-height: none !important; }
body.h5.kb-open .h5-tabbar { display: none !important; }
body.h5.kb-open #page { padding-bottom: 10px; }

/* ---- 首页改版：常用应用（可自定义）→ 全部应用（默认折叠）→ 板块 ---- */
#h5-grid { padding: 0 12px 2px; margin-top: -4px; }
.h5-allapp-hd { width: 100%; border: none; background: none; display: flex; align-items: center; gap: 6px;
  padding: 2px 4px 8px; color: #8A97AB; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; cursor: pointer; }
.h5-allapp-hd:active { opacity: .7; }
.h5-allapp-n { font-style: normal; font-weight: 600; font-size: 10.5px; color: #5B6B85; background: #EEF2F9; border-radius: 8px; padding: 0 6px; line-height: 16px; }
.h5-allapp-c { margin-left: auto; font-style: normal; font-size: 13px; transition: transform .18s ease; }
.h5-allapp-hd.on .h5-allapp-c { transform: rotate(180deg); }
.h5-grid-row[hidden] { display: none; }

/* 板块折叠（仅超过阈值的长板块会带上这些类） */
.h5-fold-hd { cursor: pointer; user-select: none; -webkit-user-select: none; }
.h5-fold-hd:active { background: #F6F8FC; }
.h5-fold-hd .h5-fold-btn { margin-left: 10px; color: #8A97AB; font-size: 14px; line-height: 1; transition: transform .18s ease; flex: none; }
.h5-fold.folded .h5-fold-btn { transform: rotate(-90deg); }
.h5-fold-body { overflow: hidden; transition: max-height .22s ease; }
.h5-fold.folded .card-hd { border-bottom: none; }
