/* 商家端与用户端的手机操作补强。桌面布局不受本文件影响。 */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (max-width: 767px) {
  body.merchant-body,
  body[data-support-channel="user"] {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    overscroll-behavior-x: none;
  }

  body.merchant-body button,
  body.merchant-body a,
  body[data-support-channel="user"] button,
  body[data-support-channel="user"] a {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  body.merchant-body input,
  body.merchant-body select,
  body.merchant-body textarea,
  body[data-support-channel="user"] input,
  body[data-support-channel="user"] select,
  body[data-support-channel="user"] textarea {
    max-width: 100%;
    font-size: 16px;
  }

  body.merchant-body input:not([type="checkbox"]):not([type="radio"]),
  body.merchant-body select,
  body.merchant-body textarea,
  body[data-support-channel="user"] input:not([type="checkbox"]):not([type="radio"]),
  body[data-support-channel="user"] select,
  body[data-support-channel="user"] textarea {
    min-height: 44px;
  }

  /* 商家端：抽屉菜单、单列表单与底部安全区。 */
  body.merchant-body .fixed-header {
    height: calc(56px + env(safe-area-inset-top, 0px));
    min-height: calc(56px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
  }

  body.merchant-body .app-container {
    min-width: 0;
    padding-top: calc(56px + env(safe-area-inset-top, 0px));
    padding-left: 0;
  }

  body.merchant-body .app-sidebar-container,
  body.merchant-body .merchant-layout-v2 .app-sidebar-container.lx-layout__sidebar {
    top: calc(56px + env(safe-area-inset-top, 0px));
    height: calc(100dvh - 56px - env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.merchant-body .sidebar-menu {
    display: grid;
    width: 100%;
    overflow: visible;
  }

  body.merchant-body .sidebar-item {
    width: 100%;
    min-height: 48px;
    height: auto;
    flex: none;
  }

  body.merchant-body .app-main,
  body.merchant-body .reference-page-mode .app-main,
  body.merchant-body .reference-page-mode.publish-route-mode .app-main {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    padding: 12px 10px calc(28px + env(safe-area-inset-bottom, 0px));
  }

  body.merchant-body .merchant-panel,
  body.merchant-body .workspace-panel,
  body.merchant-body .merchant-page-heading {
    min-width: 0;
    padding: 14px 12px;
    border-radius: 10px;
  }

  body.merchant-body .summary-heading,
  body.merchant-body .summary-actions,
  body.merchant-body .publish-actions,
  body.merchant-body .store-modal-actions,
  body.merchant-body .merchant-modal-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  body.merchant-body .summary-actions button,
  body.merchant-body .publish-actions button,
  body.merchant-body .store-modal-actions button,
  body.merchant-body .merchant-modal-actions button,
  body.merchant-body .form-actions button {
    width: 100%;
    min-height: 46px;
  }

  body.merchant-body .panel-form,
  body.merchant-body .compact-form,
  body.merchant-body .pay-submit-form,
  body.merchant-body .publish-grid,
  body.merchant-body .publish-grid.compact,
  body.merchant-body .store-form,
  body.merchant-body .store-bind-form {
    grid-template-columns: minmax(0, 1fr);
  }

  body.merchant-body .form-wide,
  body.merchant-body .pay-submit-form > *,
  body.merchant-body .publish-grid > * {
    min-width: 0;
    grid-column: 1 / -1;
  }

  body.merchant-body .simple-table,
  body.merchant-body .activity-tabs,
  body.merchant-body .mission-status-block,
  body.merchant-body .publish-platform-line {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.merchant-body .merchant-user-hub-head {
    padding: 16px 14px;
  }

  body.merchant-body .merchant-user-hub-head > a {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  body.merchant-body .merchant-user-hub-frame {
    min-height: max(900px, calc(100dvh - 120px));
    border-radius: 8px;
  }

  body.merchant-body .merchant-modal,
  body.merchant-body .modal-mask,
  body.merchant-body .merchant-repayment-modal {
    padding: env(safe-area-inset-top, 0px) 0 0;
    place-items: end center;
  }

  body.merchant-body .merchant-modal-box,
  body.merchant-body .store-detail-modal .merchant-modal-box,
  body.merchant-body .merchant-repayment-dialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px));
    margin: 0;
    overflow-y: auto;
    border-radius: 12px 12px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  body.merchant-body .contact-float {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  /* 用户端：固定快捷导航、单列任务卡和拇指友好操作区。 */
  body[data-support-channel="user"] {
    padding-top: 0;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  body[data-support-channel="user"] .trial-topbar {
    top: 0;
    height: calc(56px + env(safe-area-inset-top, 0px));
    min-height: calc(56px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0;
    flex-wrap: nowrap;
  }

  body[data-support-channel="user"] .trial-brand-group {
    gap: 7px;
    min-width: 0;
  }

  body[data-support-channel="user"] .trial-merchant-switch {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  body[data-support-channel="user"] .trial-activity-status-bar {
    display: block;
  }

  body[data-support-channel="user"] .trial-credit-compact {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 10px 12px;
  }

  body[data-support-channel="user"] .trial-sidebar {
    top: calc(56px + env(safe-area-inset-top, 0px));
    height: calc(100dvh - 56px - env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body[data-support-channel="user"] .trial-sidebar button {
    min-height: 48px;
  }

  body[data-support-channel="user"] .trial-workbench {
    width: calc(100% - 16px);
    max-width: 100%;
    margin: 8px auto calc(22px + env(safe-area-inset-bottom, 0px));
  }

  body[data-support-channel="user"] .trial-activity-grid,
  body[data-support-channel="user"] .review-form,
  body[data-support-channel="user"] .trial-upgrade-form,
  body[data-support-channel="user"] .trial-feedback-reply-form {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-support-channel="user"] .review-form .form-wide,
  body[data-support-channel="user"] .trial-upgrade-form .form-wide {
    grid-column: 1 / -1;
  }

  body[data-support-channel="user"] .review-form .primary-action,
  body[data-support-channel="user"] .trial-upgrade-form button[type="submit"] {
    width: 100%;
    min-height: 46px;
  }

  body[data-support-channel="user"] .trial-task-card > footer,
  body[data-support-channel="user"] .trial-my-task > footer {
    gap: 8px;
  }

  body[data-support-channel="user"] .trial-task-card > footer button,
  body[data-support-channel="user"] .trial-my-task > footer button {
    min-height: 44px;
  }

  body[data-support-channel="user"] .wx-tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e1e7ec;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 -8px 24px rgba(17, 24, 39, .09);
    backdrop-filter: blur(16px);
  }

  body[data-support-channel="user"] .wx-tabbar button {
    min-width: 0;
    min-height: 46px;
    border: 0;
    border-radius: 10px;
    color: #667085;
    background: #f5f7f9;
    font-size: 13px;
    font-weight: 800;
  }

  body[data-support-channel="user"] .wx-tabbar button.is-active {
    color: #fff;
    background: #0f8f81;
  }

  body[data-support-channel="user"] .contact-float {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  html.trial-embedded-mode body[data-support-channel="user"] {
    padding-bottom: 0;
  }
}

@media (max-width: 380px) {
  body.merchant-body .app-main {
    padding-right: 8px;
    padding-left: 8px;
  }

  body[data-support-channel="user"] .trial-workbench {
    width: calc(100% - 12px);
  }

  body[data-support-channel="user"] .trial-shop-banner,
  body[data-support-channel="user"] .trial-finance-withdrawal > header,
  body[data-support-channel="user"] .trial-finance-withdrawal .withdraw-form.is-inline {
    padding-right: 12px;
    padding-left: 12px;
  }
}
