/* ============================================================
   W46 · 手机 H5 适配（≤ 820px 生效，桌面端完全不受影响）
   只做三件事：侧栏变抽屉、表格可横滑、底部快捷导航
   ============================================================ */

/* 手机端才显示的元素 */
.only-m { display: none !important; }

@media (max-width: 820px) {

  /* ---------- 外壳 ---------- */
  html, body { -webkit-text-size-adjust: 100%; }
  .app { flex-direction: column; }

  /* 侧栏：变成从左滑出的抽屉 */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 90;
    width: 76vw; max-width: 300px;
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.18);
    overflow-y: auto;
  }
  .sidebar.open { transform: none; }
  .side-mask {
    position: fixed; inset: 0; z-index: 89;
    background: rgba(16,24,40,.42);
    backdrop-filter: blur(1px);
  }

  /* 顶栏：加高一点，给汉堡按钮留位置 */
  .topbar { height: 52px; flex: 0 0 52px; padding: 0 12px; gap: 8px; }
  .topbar h1 { font-size: 15px; }
  .topbar .sub { display: none; }              /* 副标题在手机上太挤 */
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; margin-right: 2px;
    border: 0; background: transparent; border-radius: 8px;
    font-size: 19px; line-height: 1; color: var(--text-2, #475467); cursor: pointer;
  }
  .menu-btn:active { background: #EEF1F6; }

  /* 内容区：底部给导航条留出空间 */
  .page { padding: 14px 12px 86px !important; max-width: 100%; }
  .content { -webkit-overflow-scrolling: touch; }

  /* ---------- 表格：手机上横滑，不压扁 ---------- */
  .page table, .card table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .page table thead, .page table tbody { display: table; width: 100%; min-width: 620px; }
  .page table th, .page table td { white-space: nowrap; }

  /* 卡片里的一行多列（row/field）改成上下堆叠 */
  .row { flex-wrap: wrap; }
  .card { border-radius: 12px; }

  /* 按钮、输入框：手指友好 */
  .btn { min-height: 34px; }
  .input, input[type="text"], input[type="number"], input[type="date"], select, textarea {
    font-size: 16px !important;      /* 16px 以下 iOS 会自动放大页面，必须 16 */
    min-height: 36px;
  }
  .btn-sm { min-height: 30px; }

  /* 统计块：一行两个 */
  .stats, .grid-2, .grid-3 { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }

  /* 弹窗：手机上占满宽度、从底部升起 */
  .wm-mask, .mask { align-items: flex-end !important; }
  .wm-dlg, .modal, .dlg {
    width: 100% !important; max-width: 100% !important;
    max-height: 92vh; border-radius: 16px 16px 0 0 !important;
    margin: 0 !important;
  }

  /* ---------- 底部快捷导航 ---------- */
  .mb-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    display: flex; align-items: stretch;
    height: 60px; padding-bottom: env(safe-area-inset-bottom, 0);
    background: rgba(255,255,255,.96);
    border-top: 1px solid var(--line, #E4E7EC);
    backdrop-filter: blur(8px);
  }
  .mb-bar a {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    font-size: 10.5px; color: var(--text-3, #667085);
    text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .mb-bar a.on { color: var(--brand, #3B5BDB); font-weight: 600; }
  .mb-bar a svg { width: 20px; height: 20px; }

  /* 手机上显示、桌面隐藏 */
  .only-m { display: block !important; }
  .mb-bar.only-m, .mb-bar { display: flex !important; }
  .menu-btn.only-m { display: inline-flex !important; }
  .side-mask.only-m { display: block !important; }
  .no-m { display: none !important; }
  .modal-mask { z-index: 200 !important; }
  .modal { z-index: 201 !important; top: auto !important; bottom: 0 !important; left: 0 !important; right: 0 !important;
           transform: none !important; width: 100% !important; max-width: 100% !important;
           border-radius: 16px 16px 0 0 !important; animation: mbslide .2s ease !important; }
  .wm-mask { z-index: 200; }
  .wm-dlg { z-index: 201; position: relative; }
  .toast-wrap { z-index: 300; }
  @keyframes mbslide { from { transform: translateY(28px); opacity: .6 } to { transform: none; opacity: 1 } }

  /* ---------- 线索池：手机端卡片列表 ---------- */
  .mb-leads { padding: 2px 0 4px; }
  .mb-lead {
    background: #fff; border: 1px solid var(--line, #E4E7EC);
    border-radius: 12px; padding: 11px 12px; margin-bottom: 9px;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .mb-lead:active { background: #F7F9FC; }
  .mb-lead-h { display: flex; align-items: center; gap: 8px; }
  .mb-lead-n { font-size: 14.5px; font-weight: 600; }
  .mb-call {
    margin-left: auto; font-size: 11.5px; padding: 3px 10px; border-radius: 999px;
    background: #EEF2FF; color: var(--brand, #3B5BDB); text-decoration: none; flex: none;
  }
  .mb-lead-b { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
  .mb-k {
    font-size: 11.5px; color: var(--text-3, #667085);
    background: #F5F7FB; padding: 2px 8px; border-radius: 6px;
  }
  .mb-lead-f { margin-top: 7px; font-size: 11px; color: var(--text-4, #98A2B3); }
  .mb-empty { text-align: center; padding: 40px 0; color: var(--text-4, #98A2B3); font-size: 13px; }


  /* ---------- 抽屉（线索详情）：手机端铺满 + 两栏改单栏 ---------- */
  .drawer { width: 100% !important; max-width: 100% !important; }
  .drawer-h { padding: 12px 14px !important; flex-wrap: wrap; gap: 6px !important; }
  .drawer-h h2 { font-size: 15px !important; }
  .drawer-b { padding: 0 !important; }
  /* 内联的两栏 grid → 单栏 */
  .drawer-b > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .drawer-b > div > div { border-right: 0 !important; padding: 14px !important; }
  .drawer-b > div > div + div { border-top: 1px solid var(--line, #E4E7EC); }
  .drawer-f { padding: 10px 12px !important; }
  .drawer-f .btn { flex: 1; }
  .tp-card {
    max-height: 88dvh !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
  }
}


  /* 弹窗必须盖在底部导航之上（否则"取消/确定"被导航条挡住） */

  /* ---------- 问卷里的时间选择器：手机上要能看见完整时间 ---------- */
  .tp-b { overflow-y: auto !important; -webkit-overflow-scrolling: touch; flex: 1; overscroll-behavior: contain; }
  .tp-cols { display: flex; gap: 8px; }
  .tp-col, .tp-list { max-height: 34dvh; overflow-y: auto; }
  .tp-f, .tp-foot { flex: none; }
  .tp-col div, .tp-list div { min-height: 40px; line-height: 40px; }
/* 超小屏（iPhone SE 一类） */
@media (max-width: 380px) {
  .stats, .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
}
