/* ==========================================================================
   邻而帮平台 · 移动端基线（mobile-native）
   --------------------------------------------------------------------------
   全部规则限定在 .lb-scope 容器内，不影响子比主题既有页面样式。
   平台页面（工作台 / 运营后台 / H5）根节点需加 class="lb-scope"。

   覆盖的"网页感"来源：
   1. 点击灰色高亮闪烁     → -webkit-tap-highlight-color
   2. 粘滞 hover          → @media (hover: hover) and (pointer: fine)
   3. 100vh 高度错误       → 100dvh / 100svh
   4. 输入框聚焦页面缩放   → 输入类字号 ≥16px
   5. 点击 300ms 延迟      → touch-action: manipulation
   6. 下拉刷新劫持滚动     → overscroll-behavior
   7. 内容被刘海遮挡       → env(safe-area-inset-*)
   8. 长按选中按钮文字     → user-select: none（仅控件；内容显式可选中，见第 8 节）
   9. 横滑组件方向误判     → touch-action: pan-y
  10. 状态栏颜色不匹配     → theme-color（由页面 meta 输出）

   P3-F2 补强（见文末「移动端体验补强」）：
  11. 键盘/外接设备焦点不可见 → :focus-visible（触摸不触发）
  12. 暗色下自动填充白底   → autofill 背景归一
  13. 搜索框取消按钮原生差异 → input[type=search] 归一
  14. 长案号/长链接撑破窄屏 → overflow-wrap: break-word
   ========================================================================== */

/* ---------- 1. 点击高亮与文字缩放 ---------- */
.lb-scope,
.lb-scope * {
  -webkit-tap-highlight-color: transparent;
}

.lb-scope {
  -webkit-text-size-adjust: 100%;
  font-family: var(--lb-font);
  font-size: var(--lb-fs-body);
  line-height: var(--lb-lh-body);
  color: var(--lb-label);
  /* 不铺底色：跟随子比主题页面背景，避免出现与页面割裂的灰带 */
  background: transparent;
  /* 6. 阻止页面级下拉刷新/橡皮筋劫持内部滚动容器 */
  overscroll-behavior: none;
}

.lb-scope *,
.lb-scope *::before,
.lb-scope *::after {
  box-sizing: border-box;
}

/* ---------- 2. 粘滞 hover：只在真正支持 hover 的设备上生效 ---------- */
@media (hover: hover) and (pointer: fine) {
  .lb-btn:hover { background: var(--lb-brand-hover); }
  .lb-btn--secondary:hover { background: var(--lb-fill-2); }
  .lb-btn--ghost:hover { background: var(--lb-fill-3); }
  /* 反白兜底（v1.3.404）：--plain / --danger 是「透明底 / 红底」变体，
     若不覆盖上级 `.lb-btn:hover` 的实心品牌色，hover 会刷成蓝底蓝字（文字不可读）、
     红按钮变蓝。务必与上面三条同处一个媒体查询内，保持同级覆盖。 */
  .lb-btn--plain:hover { background: var(--lb-brand-soft); }
  .lb-btn--danger:hover { background: var(--lb-red-hover); }
  .lb-list-row:hover { background: var(--lb-fill-3); }
  .lb-card--interactive:hover { box-shadow: var(--lb-shadow-lg); transform: translateY(-1px); }
  .lb-link:hover { text-decoration: underline; }
}

/* ---------- 2b. 链接型按钮的文字色兜底（v1.3.451） ----------
   子比主题 `zibll/css/main.css:478` 有一条裸规则
       a:hover, a:focus { color: var(--focus-color); }   ← 特异性 (0,1,1)
   而 `.lb-btn` 的文字色只有 (0,1,0)；上面 2. 里的 hover 块**只改背景、不声明文字色**
   ⇒ `<a class="lb-btn">`（蓝底白字）一悬停/聚焦，文字就被刷成主题蓝，落在品牌蓝底上
   完全读不出来（看上去就是「整块纯蓝」）。
   ⚠ 全站唯一会中招的是申请人页「发起委托」——页面里唯一的 `<a class="lb-btn">`；
   Tab / 筛选胶囊 / 卡片按钮都是 `<button>`，不受 `a:hover` 影响，所以此前只有它出问题。
   下面用 `a.` 前缀把特异性提到 (0,3,1) 并显式声明各变体文字色（:focus 一并覆盖，
   键盘 Tab 聚焦时同样不会被主题刷蓝）。 */
.lb-scope a.lb-btn:hover,
.lb-scope a.lb-btn:focus,
.lb-scope a.lb-btn:active { color: var(--lb-on-brand); }

.lb-scope a.lb-btn--secondary:hover,
.lb-scope a.lb-btn--secondary:focus,
.lb-scope a.lb-btn--secondary:active,
.lb-scope a.lb-btn--ghost:hover,
.lb-scope a.lb-btn--ghost:focus,
.lb-scope a.lb-btn--ghost:active,
.lb-scope a.lb-btn--plain:hover,
.lb-scope a.lb-btn--plain:focus,
.lb-scope a.lb-btn--plain:active { color: var(--lb-brand); }

.lb-scope a.lb-btn--danger:hover,
.lb-scope a.lb-btn--danger:focus,
.lb-scope a.lb-btn--danger:active { color: #FFFFFF; }

/* ---------- 3. 视口高度 ---------- */
.lb-app {
  display: flex;
  flex-direction: column;
  height: 100dvh;      /* 应用外壳：跟随浏览器 chrome 收缩 */
  overflow: hidden;
}

.lb-hero {
  min-height: 100svh;  /* 首屏：取最小视口，任何情况下不被裁切 */
}

/* 兜底：不支持 dvh 的旧内核 */
@supports not (height: 100dvh) {
  .lb-app { height: 100vh; }
}

/* ---------- 4. 输入框字号：≥16px 防止 iOS 聚焦缩放 ---------- */
.lb-scope input,
.lb-scope textarea,
.lb-scope select {
  font-size: 16px;
  font-family: inherit;
}

/* ---------- 5. 点击响应：去掉双击缩放等待 + 按下即反馈 ---------- */
.lb-scope button,
.lb-scope a,
.lb-scope [role="button"],
.lb-scope .lb-tappable,
.lb-btn {
  touch-action: manipulation;
}

/* ---------- 8. 长按选择：内容可选中 / 控件不可选中（v1.3.483 重写） ----------
   背景：站点全局存在「禁长按选择 / 禁右键」限制（来源为其他插件或主题外注入，
         我们无法定位其实现）。插件新增的各角色工作台（页面根节点均为 `.lb-scope`）
         必须支持长按选择文字复制，其它页面维持禁选不变。
   做法：分两段 ——
         · 8a 对 `.lb-scope` 全树**显式**声明「可选中」（带 `!important`，以压过站点
           全局的 `user-select:none` / `-webkit-touch-callout:none`）。此前注释虽写
           「内容保持可选中」，但从未落地声明 ⇒ 内容只能**继承**外部的 `none`。
         · 8b 再对控件类元素声明「不可选中」；8a 在前、8b 在后，且 8b 元素选择器
           特异性（≥0,1,1）高于 8a 的 `.lb-scope *`（0,1,0）⇒ 控件必定胜出。
   作用域：全部规则限 `.lb-scope` 容器，不影响子比主题既有页面。
   配套：`O2B_LB_Pages::enqueue_scripts()` 另输出一段捕获阶段 JS 兜底（见该处注释）。 */
.lb-scope,
.lb-scope * {
  -webkit-user-select: text !important;
  user-select: text !important;
  -webkit-touch-callout: default !important;
}

/* 8b. 控件文字不可选中（含长按菜单） */
.lb-scope .lb-btn,
.lb-scope button,
.lb-scope [role="button"],
.lb-scope .lb-segmented,
.lb-scope .lb-chip,
.lb-scope .lb-tab,
.lb-scope .lb-drag-handle,
.lb-scope [data-mic] {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

/* ---------- 9. 手势方向归属 ---------- */
/* LB-674：`pan-y` 只把**纵向**让给浏览器，横向手势被容器接管 → 手机上横滑一根不动。
   横滑类容器（委托列表标签排 / 详情页 tab 排）两个方向都要放行：页面纵滚照常、
   容器横滚也照常，浏览器按手势初方向自行择一。 */
.lb-hscroll {
  touch-action: pan-x pan-y;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.lb-hscroll::-webkit-scrollbar { display: none; }

.lb-drag-surface {
  touch-action: none;               /* 自定义手势（拖拽关闭面板等）独占全部方向 */
}

/* 内部滚动容器：滚动到边界不链式带动页面 */
.lb-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---------- 7. 安全区（刘海 / Home Indicator） ---------- */
.lb-safe-top { padding-top: env(safe-area-inset-top, 0px); }
.lb-safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }
.lb-safe-x {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.lb-header {
  padding-top: calc(var(--lb-sp-5) + env(safe-area-inset-top, 0px));
  padding-left: calc(var(--lb-sp-6) + env(safe-area-inset-left, 0px));
  padding-right: calc(var(--lb-sp-6) + env(safe-area-inset-right, 0px));
}

.lb-bottom-bar {
  padding-bottom: calc(var(--lb-sp-5) + env(safe-area-inset-bottom, 0px));
}

.lb-sheet {
  padding-bottom: calc(var(--lb-sp-7) + env(safe-area-inset-bottom, 0px));
}

/* 底部固定操作条（表单页「下一步/上一步」） */
.lb-action-bar {
  position: sticky;
  bottom: 0;
  z-index: var(--lb-z-sticky);
  padding: var(--lb-sp-5) var(--lb-sp-6);
  padding-bottom: calc(var(--lb-sp-5) + env(safe-area-inset-bottom, 0px));
  background: var(--lb-material-bg);
  -webkit-backdrop-filter: var(--lb-blur-regular);
  backdrop-filter: var(--lb-blur-regular);
  border-top: 1px solid var(--lb-separator);
}

/* ---------- 可访问性：降低动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  .lb-scope *,
  .lb-scope *::before,
  .lb-scope *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 120ms !important;
    scroll-behavior: auto !important;
  }
  /* 大位移改为纯透明度过渡，去掉滑动与超调 */
  .lb-sheet,
  .lb-modal,
  .lb-drawer {
    transform: none !important;
  }
}

/* ---------- 可访问性：降低透明度 ---------- */
@media (prefers-reduced-transparency: reduce) {
  .lb-material,
  .lb-action-bar,
  .lb-header--blur {
    background: var(--lb-bg-elevated) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

/* ---------- 可访问性：增强对比 ---------- */
@media (prefers-contrast: more) {
  .lb-scope {
    --lb-label: #000000;
    --lb-label-2: rgba(0, 0, 0, 0.75);
    --lb-separator: rgba(0, 0, 0, 0.55);
  }
  body.dark-theme .lb-scope {
    --lb-label: #FFFFFF;
    --lb-label-2: rgba(255, 255, 255, 0.80);
    --lb-separator: rgba(255, 255, 255, 0.55);
  }
  .lb-card,
  .lb-btn--secondary,
  .lb-input {
    border: 1px solid var(--lb-separator);
  }
}

/* ---------- 文字层级工具（对应 Token 字阶） ---------- */
.lb-t-large-title { font-size: var(--lb-fs-large-title); line-height: var(--lb-lh-large-title); font-weight: var(--lb-fw-bold); letter-spacing: -0.02em; }
.lb-t-title1 { font-size: var(--lb-fs-title1); line-height: var(--lb-lh-title1); font-weight: var(--lb-fw-bold); letter-spacing: -0.02em; }
.lb-t-title2 { font-size: var(--lb-fs-title2); line-height: var(--lb-lh-title2); font-weight: var(--lb-fw-semibold); letter-spacing: -0.01em; }
.lb-t-title3 { font-size: var(--lb-fs-title3); line-height: var(--lb-lh-title3); font-weight: var(--lb-fw-semibold); letter-spacing: -0.01em; }
.lb-t-headline { font-size: var(--lb-fs-headline); line-height: var(--lb-lh-headline); font-weight: var(--lb-fw-semibold); }
.lb-t-body { font-size: var(--lb-fs-body); line-height: var(--lb-lh-body); font-weight: var(--lb-fw-regular); }
.lb-t-callout { font-size: var(--lb-fs-callout); line-height: var(--lb-lh-callout); }
.lb-t-subhead { font-size: var(--lb-fs-subhead); line-height: var(--lb-lh-subhead); }
.lb-t-footnote { font-size: var(--lb-fs-footnote); line-height: var(--lb-lh-footnote); }
.lb-t-caption { font-size: var(--lb-fs-caption1); line-height: var(--lb-lh-caption1); }

/* 文字颜色层级 */
.lb-c-1 { color: var(--lb-label); }
.lb-c-2 { color: var(--lb-label-2); }
.lb-c-3 { color: var(--lb-label-3); }
.lb-c-brand { color: var(--lb-brand); }
/* v1.3.527：待办 / 欠费类强调（签约服务费「待支付」等） */
.lb-c-orange { color: var(--lb-orange); }
.lb-c-mono { font-family: var(--lb-font-mono); font-variant-numeric: tabular-nums; }

/* 数值对齐（金额、案号） */
.lb-num { font-variant-numeric: tabular-nums; }

/* ---------- 布局工具（克制使用，避免与主题冲突） ---------- */
/* 通用行：默认允许自动换行——flex 子项含不可压缩内容（标签组、长文本）时，
   窄屏不再把父级/文档撑宽。row-gap 只在真的发生换行时生效，单行布局不受影响。 */
.lb-row { display: flex; align-items: center; flex-wrap: wrap; row-gap: var(--lb-sp-3); }
/* 两端对齐行：允许自动换行（仅在空间不足时生效，避免窄屏标题/操作挤出容器） */
.lb-row--between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--lb-sp-3) var(--lb-sp-4); }
.lb-col { display: flex; flex-direction: column; }
.lb-grow { flex: 1 1 auto; min-width: 0; }
.lb-wrap { flex-wrap: wrap; }
.lb-gap-2 { gap: var(--lb-sp-2); }
.lb-gap-3 { gap: var(--lb-sp-3); }
.lb-gap-4 { gap: var(--lb-sp-4); }
.lb-gap-5 { gap: var(--lb-sp-5); }
.lb-gap-6 { gap: var(--lb-sp-6); }
.lb-gap-7 { gap: var(--lb-sp-7); }
.lb-gap-8 { gap: var(--lb-sp-8); }
.lb-mt-4 { margin-top: var(--lb-sp-4); }
.lb-mt-5 { margin-top: var(--lb-sp-5); }
.lb-mt-6 { margin-top: var(--lb-sp-6); }
.lb-mt-8 { margin-top: var(--lb-sp-8); }
.lb-mb-4 { margin-bottom: var(--lb-sp-4); }
.lb-mb-5 { margin-bottom: var(--lb-sp-5); }
.lb-mb-6 { margin-bottom: var(--lb-sp-6); }
.lb-mb-8 { margin-bottom: var(--lb-sp-8); }
.lb-hidden { display: none !important; }
.lb-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   移动端体验补强（P3-F2）
   --------------------------------------------------------------------------
   基线（P0）已覆盖手势/视口/安全区；此处补齐三类在真机上仍会露馅的细节：
   键盘焦点可见性、暗色自动填充、长串文本在窄屏的溢出。
   全部限定 .lb-scope，不触碰子比主题既有样式。
   ========================================================================== */

/* ---------- 11. 焦点可见：仅键盘 / 外接设备触发，触摸与鼠标点击不显示 ---------- */
/* 只管非表单控件：表单控件的聚焦样式由 lb-components.css 的 :focus 统一处理 */
.lb-scope a:focus-visible,
.lb-scope button:focus-visible,
.lb-scope [role="button"]:focus-visible,
.lb-scope [tabindex]:focus-visible {
  outline: 2px solid var(--lb-brand);
  outline-offset: 2px;
}

/* ---------- 12. 自动填充：暗色下不再出现刺眼白底 ---------- */
.lb-scope input:-webkit-autofill,
.lb-scope input:-webkit-autofill:hover,
.lb-scope input:-webkit-autofill:focus,
.lb-scope textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--lb-label);
  -webkit-box-shadow: 0 0 0 1000px var(--lb-bg-input) inset;
  box-shadow: 0 0 0 1000px var(--lb-bg-input) inset;
  caret-color: var(--lb-label);
  transition: background-color 9999s ease-out 0s;
}

/* ---------- 13. 搜索框：统一去掉各内核自带的原生装饰 ---------- */
.lb-scope input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}
.lb-scope input[type="search"]::-webkit-search-decoration,
.lb-scope input[type="search"]::-webkit-search-cancel-button,
.lb-scope input[type="search"]::-webkit-search-results-button {
  -webkit-appearance: none;
  appearance: none;
}

/* ---------- 14. 长串文本（案号 / 链接 / 手机号）不撑破窄屏 ---------- */
.lb-scope {
  overflow-wrap: break-word;
}

/* ---------- 15. 线框图标归一：子比主题全局 svg 规则 ----------
 * 子比主题 main.css 对所有 svg 声明 `fill: currentColor`
 * （zibll/css/main.css:506-512）。CSS 声明会压过 SVG 自身的 `fill="none"`
 * 呈现属性 ⇒ 插件内所有线框图标在真实主题页里被填成实心色块，内部线条
 * （时钟指针 / 钢笔 / 麦克风等）与填充同色而不可见。
 * 按属性精确匹配：只把显式声明 fill="none" 的线框图标还原为透明填充；
 * 主题原有的实心图标（无该属性）不受影响。 */
.lb-scope svg[fill="none"] {
  fill: none;
}