/* Mobile feature navigation and chat actions. The controls stay in the page flow. */
.bm-mobile-feature-nav,
.bm-mobile-chat-actions,
.bm-transfer-shade,
.bm-mobile-right-close {
  display: none;
}

@media (max-width: 700px) {
  .bowen-transfer-btn { display: none !important; }

  .bm-mobile-feature-nav:not([hidden]) {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    z-index: 80;
    display: flex;
    gap: 4px;
    min-height: 46px;
    padding: 5px 8px;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    background: #fff;
    border-bottom: 1px solid #e9edf1;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .bm-mobile-feature-nav::-webkit-scrollbar { display: none; }

  .bm-mobile-feature-item {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #e0e5ea;
    border-radius: 6px;
    background: #fff;
    color: #4c5968;
    font: 14px/34px system-ui, -apple-system, 'Microsoft YaHei', sans-serif;
    white-space: nowrap;
    touch-action: manipulation;
  }

  .bm-mobile-feature-item.selected {
    border-color: #a72b22;
    background: #fff3ef;
    color: #a72b22;
    font-weight: 600;
  }

  body:not([data-mobile-chat]) .app-main.bowen-page-scroll {
    top: 96px !important;
    height: calc(100dvh - 96px) !important;
    padding-top: 8px !important;
  }

  body[data-mobile-chat="chat"] .bm-mobile-chat-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    margin-left: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  body[data-mobile-chat="chat"] .bm-mobile-chat-actions::-webkit-scrollbar { display: none; }

  .bm-mobile-chat-action {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 8px;
    border: 1px solid #dfe4e9;
    border-radius: 6px;
    background: #fff;
    color: #596675;
    font-size: 13px;
    white-space: nowrap;
    touch-action: manipulation;
  }

  .bm-mobile-chat-action.bm-mobile-transfer-open {
    border-color: #e2b8b2;
    color: #a72b22;
  }

  body[data-mobile-chat="chat"] .bm-mobile-right-panel,
  body[data-mobile-chat="chat"].bm-mobile-right-open .conversation-tools {
    display: block !important;
    position: fixed !important;
    z-index: 190 !important;
    top: 48px !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    overflow: auto !important;
    box-sizing: border-box !important;
    padding: 42px 10px 20px !important;
    background: #fff !important;
    -webkit-overflow-scrolling: touch;
  }

  .bm-mobile-right-close {
    position: absolute;
    top: 7px;
    right: 10px;
    z-index: 2;
    display: block;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid #dfe4e9;
    border-radius: 6px;
    background: #fff;
    color: #687482;
    font-size: 13px;
  }

  .bm-transfer-shade {
    position: fixed;
    z-index: 10050;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    box-sizing: border-box;
    padding: 0;
    background: rgba(22, 29, 38, .36);
  }

  .bm-transfer-panel {
    width: 100%;
    max-height: 82dvh;
    overflow: auto;
    box-sizing: border-box;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 12px 12px 0 0;
    background: #fff;
    color: #26313e;
    -webkit-overflow-scrolling: touch;
  }

  .bm-transfer-title { margin: 0 0 6px; font-size: 18px; }
  .bm-transfer-hint { margin: 0 0 14px; color: #7d8792; font-size: 13px; line-height: 1.6; }
  .bm-transfer-targets { width: 100%; min-height: 42px; padding: 0 10px; border: 1px solid #dfe3e8; border-radius: 6px; background: #fff; font-size: 16px; }
  .bm-transfer-notice { min-height: 20px; margin: 8px 0; color: #a72b22; font-size: 13px; }
  .bm-transfer-actions { display: flex; gap: 8px; justify-content: flex-end; }
  .bm-transfer-actions button { min-height: 42px; padding: 0 16px; border-radius: 6px; font-size: 15px; touch-action: manipulation; }
  .bm-transfer-cancel { border: 1px solid #dfe3e8; background: #fff; color: #606b78; }
  .bm-transfer-submit { border: 1px solid #a72b22; background: #a72b22; color: #fff; }
}

@media (min-width: 701px) {
  .bm-mobile-feature-nav, .bm-mobile-chat-actions, .bm-transfer-shade, .bm-mobile-right-close { display: none !important; }
}
