/* Mobile presentation layer.
   This file deliberately changes layout only: routes, form names, element ids
   and JavaScript hooks remain owned by their existing modules. */

@media (max-width: 760px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    overflow-wrap: break-word;
  }

  :where(input, select, textarea, button) {
    font-size: 16px;
  }

  /* Shared brand: retain the complete lockup without letting it crowd actions. */
  .fenzishu-unified-header {
    min-height: 68px !important;
  }

  .fenzishu-brand {
    width: 202px;
    height: 52px;
    grid-template-columns: 116px minmax(0, 1fr);
    gap: 7px;
  }

  .fenzishu-brand-logo-frame {
    width: 116px;
    height: 42px;
  }

  .fenzishu-brand-wordmark {
    top: -11px;
    left: -13px;
    width: 126px;
  }

  .fenzishu-brand-tagline {
    min-height: 30px;
    padding-left: 7px;
  }

  .fenzishu-brand-tagline strong {
    font-size: 10.5px;
    line-height: 14px;
  }

  .fenzishu-brand-tagline small {
    font-size: 9px;
    line-height: 13px;
  }

  /* Business and management shells already expose a mobile navigation button. */
  body.vnext-portal .fenzishu-brand {
    width: 118px;
    grid-template-columns: 118px;
    gap: 0;
  }

  body.vnext-portal .fenzishu-brand-tagline {
    display: none !important;
  }

  body.vnext-portal .opc-topbar {
    min-height: 62px !important;
    padding: 7px 10px !important;
  }

  body.vnext-portal .opc-topbar-right {
    gap: 4px !important;
  }

  body.vnext-portal .opc-account-menu > summary,
  body.vnext-portal .opc-top-message {
    min-width: 42px;
    min-height: 42px;
  }

  body.vnext-portal .opc-shell,
  body[data-vnext-business-layer="1"] main.opc-shell {
    padding: 12px 10px 34px !important;
  }

  body.vnext-portal .vnext-portal-mobile-menu {
    margin-bottom: 10px;
  }

  body.vnext-portal .vnext-portal-mobile-toggle {
    min-height: 44px;
    border-radius: 11px;
    box-shadow: 0 3px 12px rgba(27, 70, 121, .04);
  }

  body.vnext-portal .vnext-portal-mobile-menu .vnext-mobile-nav {
    max-height: min(65dvh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body.vnext-portal .vnext-portal-mobile-menu .vnext-mobile-child {
    padding-left: 28px;
    font-size: 14px;
    min-height: 44px;
  }
  .dm-market-filters .dm-filter-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }
  .dm-market-filters .dm-filter-tabs > button {
    min-width: 0;
    min-height: 44px;
    white-space: normal;
  }

  body.vnext-portal .opc-pagehead,
  body.vnext-portal .bv-page-head {
    margin-bottom: 12px;
  }

  body.vnext-portal .opc-pagehead h1,
  body.vnext-portal .bv-page-head h1 {
    font-size: 24px;
    line-height: 1.25;
  }

  body.vnext-portal .opc-pagehead .opc-desc,
  body.vnext-portal .bv-page-head p {
    font-size: 13px;
    line-height: 1.65;
  }

  body.vnext-portal .opc-panel,
  body.vnext-portal .bv-panel {
    border-radius: 12px;
  }

  body.vnext-portal .opc-panel {
    padding: 16px 14px;
  }

  body.vnext-portal .opc-panel-head {
    align-items: flex-start;
    gap: 10px;
  }

  body.vnext-portal .opc-filters {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
  }

  body.vnext-portal .opc-field input,
  body.vnext-portal .opc-field select,
  body.vnext-portal .opc-field textarea {
    min-height: 44px;
  }

  .bv-source-state,
  .bv-empty {
    min-height: 112px;
    padding: 22px 16px;
    text-align: center;
  }

  .bv-source-state.is-loading {
    flex-direction: column;
    gap: 10px;
  }

  /* Supply management tabs become explicit choices instead of a clipped rail. */
  .bv-tabs {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 10px;
    overflow: visible;
    border-bottom: 1px solid var(--bv-line);
    background: #f8fbff;
  }

  .bv-tabs button {
    min-width: 0;
    min-height: 42px;
    padding: 7px 8px;
    border: 1px solid #dce6f2;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    line-height: 1.3;
  }

  .bv-tabs button.is-active {
    border-color: #9fc4f5;
    background: #eaf3ff;
  }

  .bv-tabs button.is-active::after {
    right: 10px;
    bottom: 3px;
    left: 10px;
    height: 2px;
    border-radius: 999px;
  }

  /* Standalone registration: all three stages remain visible at once. */
  .reg-heading {
    padding: 17px 15px;
  }

  .reg-heading h1 {
    font-size: 23px;
  }

  .reg-layout {
    padding: 10px 9px 28px;
  }

  .reg-steps {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
    padding: 8px;
    overflow: visible;
  }

  .reg-steps .reg-step {
    min-width: 0;
    min-height: 66px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 7px 3px;
    border: 1px solid var(--reg-line);
    border-radius: 8px;
    text-align: center;
  }

  .reg-steps .reg-step.is-active {
    border-color: #9fc4f5;
  }

  .reg-steps .reg-step > span {
    width: 28px;
    height: 28px;
  }

  .reg-steps .reg-step strong {
    font-size: 12px;
    line-height: 1.25;
  }

  .reg-steps .reg-step small {
    display: none;
  }

  .reg-section {
    padding: 18px 15px;
  }

  .reg-section-head {
    margin-bottom: 16px;
  }

  .reg-submitbar {
    padding: 14px 15px;
  }

  /* Opportunity inbox: turn the five-column desktop table into readable cards. */
  body.vnext-supply #secLeads .opportunity-tabs,
  body.vnext-supply[data-vnext-module="opportunities"] .opportunity-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 4px;
  }

  body.vnext-supply #secLeads .opportunity-tab,
  body.vnext-supply[data-vnext-module="opportunities"] .opportunity-tab {
    min-width: 0;
    min-height: 42px;
    padding: 8px 6px;
    font-size: 13px;
  }

  body.vnext-supply #leadZone .opc-table-wrap {
    overflow: visible;
  }

  body.vnext-supply #leadZone .opc-table {
    width: 100%;
    min-width: 0;
    display: block;
  }

  body.vnext-supply #leadZone .opc-table thead {
    display: none;
  }

  body.vnext-supply #leadZone .opc-table tbody {
    display: grid;
    gap: 10px;
  }

  body.vnext-supply #leadZone .opc-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px 12px;
    padding: 14px;
    border: 1px solid #dbe5f1;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(28, 66, 112, .045);
  }

  body.vnext-supply #leadZone .opc-table td {
    min-width: 0;
    display: block;
    padding: 0;
    border: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.vnext-supply #leadZone .opc-table td:first-child,
  body.vnext-supply #leadZone .opc-table td:last-child {
    grid-column: 1 / -1;
  }

  body.vnext-supply #leadZone .opc-table td:first-child {
    padding-bottom: 10px;
    border-bottom: 1px solid #e7edf5;
  }

  body.vnext-supply #leadZone .opc-table td:nth-child(2)::before,
  body.vnext-supply #leadZone .opc-table td:nth-child(3)::before,
  body.vnext-supply #leadZone .opc-table td:nth-child(4)::before {
    display: block;
    margin-bottom: 3px;
    color: #8493a8;
    font-size: 11px;
    font-weight: 600;
  }

  body.vnext-supply #leadZone .opc-table td:nth-child(2)::before { content: "领域"; }
  body.vnext-supply #leadZone .opc-table td:nth-child(3)::before { content: "匹配 / 来源"; }
  body.vnext-supply #leadZone .opc-table td:nth-child(4)::before { content: "响应状态"; }

  body.vnext-supply #leadZone .opc-table td:last-child {
    padding-top: 10px;
    border-top: 1px solid #e7edf5;
  }

  body.vnext-supply #leadZone .opc-table td:last-child .opc-btn {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }

  body.vnext-supply #leadZone .opc-pagination {
    align-items: stretch;
    flex-wrap: wrap;
    gap: 8px;
  }

  body.vnext-supply #leadZone .opc-pagination > span {
    width: 100%;
  }

  /* Management filtering remains complete, but every option is visible. */
  body.vnext-management-shell .management-review-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    padding: 5px;
    overflow: visible;
  }

  body.vnext-management-shell .management-review-tabs button {
    min-width: 0;
    min-height: 40px;
    padding: 6px 4px;
    border: 1px solid transparent;
    font-size: 12px;
    line-height: 1.25;
    white-space: normal;
  }

  body.vnext-management-shell .management-review-tabs button.is-active {
    border-color: #b9d5f8;
  }

  body.vnext-management-shell .management-trade-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 5px;
    overflow: visible;
    border: 1px solid #e0e8f2;
    border-radius: 9px;
    background: #f8fbff;
  }

  body.vnext-management-shell .management-trade-tabs button {
    min-width: 0;
    min-height: 40px;
    padding: 6px;
    border: 1px solid #e0e8f2;
    border-radius: 7px;
    background: #fff;
    font-size: 13px;
  }

  body.vnext-management-shell .management-trade-tabs button.is-active {
    border-color: #9fc4f5;
    background: #eaf3ff;
  }

  /* Search/catalog pages: compact the chrome and preserve filter access. */
  body.ms-page .ms-topbar {
    min-height: 68px;
    height: auto;
    padding: 7px 12px;
    gap: 8px;
  }

  body.ms-page .ms-topbar nav {
    gap: 5px;
  }

  body.ms-page .ms-topbar nav a {
    min-height: 42px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
  }

  body.ms-page .ms-shell {
    width: calc(100% - 18px);
    padding: 12px 0 36px;
  }

  body.ms-page .ms-breadcrumb {
    margin-bottom: 12px;
    font-size: 12px;
  }

  body.ms-page .ms-agent-strip {
    gap: 10px;
    border-radius: 10px;
  }

  body.ms-page .ms-heading {
    padding: 22px 2px 16px;
  }

  body.ms-page .ms-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 12px;
  }

  body.ms-page .ms-filters h2,
  body.ms-page .ms-boundary {
    grid-column: 1 / -1;
  }

  body.ms-page .ms-filters button {
    width: 100%;
    min-height: 42px;
    padding: 8px 9px;
    border: 1px solid #e1e9f3;
  }

  body.ms-page .ms-results-panel {
    min-height: 280px;
    border-radius: 10px;
  }

  /* Community mobile chrome and information density. */
  .community-unified-header {
    padding: 7px 9px;
  }

  .community-mobile-menu nav {
    right: 0;
    left: auto;
    width: min(230px, calc(100vw - 18px));
  }

  .community-shell {
    width: calc(100% - 18px);
    margin: 12px auto 38px;
  }

  .community-hero {
    padding: 18px;
    border-radius: 14px;
  }

  .community-hero h1 {
    margin: 6px 0 9px;
    font-size: 27px;
    line-height: 1.25;
  }

  .community-hero p {
    font-size: 14px;
    line-height: 1.7;
  }

  .account-card {
    margin-top: 14px;
    padding: 16px;
  }

  .account-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .account-metrics span {
    padding: 9px;
  }

  .community-layout {
    gap: 12px;
    margin-top: 12px;
  }

  .question-board {
    min-height: 0;
    padding: 18px 14px;
    border-radius: 14px;
  }

  .publish-panel {
    border-radius: 14px;
  }
}

@media (min-width: 360px) and (max-width: 480px) {
  /* Two compact columns keep the homepage useful without a very long scroll. */
  body.molecule-home-body .molecule-route-view[data-route-view="custom"],
  body.molecule-home-body .molecule-route-view[data-route-view="manual"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.molecule-home-body .home-direct-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  body.molecule-home-body .molecule-topbar {
    min-height: 68px;
    padding: 8px 10px;
  }

  body.molecule-home-body .molecule-account-menu > summary {
    width: 44px;
    min-height: 44px;
    padding: 0;
  }

  body.molecule-home-body .molecule-account-copy,
  body.molecule-home-body .molecule-account-chevron {
    display: none;
  }

  body.molecule-home-body .molecule-account-dot {
    width: 12px;
    height: 12px;
  }

  body.molecule-home-body .molecule-account-popover {
    position: fixed;
    top: 70px;
    right: 9px;
    width: min(276px, calc(100vw - 18px));
  }

  body.molecule-home-body .molecule-hero {
    padding: 28px 10px 42px;
  }

  body.molecule-home-body .molecule-hero-head h1 {
    font-size: 31px;
    line-height: 1.2;
  }

  body.molecule-home-body .molecule-hero-head p {
    font-size: 13px;
    line-height: 1.6;
  }

  body.molecule-home-body .molecule-search {
    margin-top: 20px;
    padding: 8px 9px 10px 13px;
    border-radius: 12px;
  }

  body.molecule-home-body .molecule-search input {
    height: 52px;
    font-size: 15px;
  }

  body.molecule-home-body .molecule-search-submit {
    height: 48px;
    margin-top: 7px;
  }

  body.molecule-home-body .home-business-shell .molecule-route-tabs {
    height: 56px;
  }

  body.molecule-home-body .home-business-shell .molecule-route-tab {
    font-size: 12px;
  }

  body.molecule-home-body .home-business-shell .molecule-route-tab small {
    display: none;
  }

  body.molecule-home-body .molecule-route-view[data-route-view="custom"],
  body.molecule-home-body .molecule-route-view[data-route-view="manual"] {
    gap: 8px;
    padding: 8px;
  }

  body.molecule-home-body .molecule-route-view[data-route-view="custom"] > .route-business-cell,
  body.molecule-home-body .molecule-route-view[data-route-view="manual"] > .route-business-cell,
  body.molecule-home-body .molecule-route-view[data-route-view="custom"] > .route-primary-card {
    min-height: 148px;
    padding: 12px 8px 10px;
  }

  body.molecule-home-body .molecule-route-view[data-route-view="custom"] .route-business-cell h3,
  body.molecule-home-body .molecule-route-view[data-route-view="manual"] .route-business-cell h3 {
    font-size: 14px;
  }

  body.molecule-home-body .route-outline-action {
    min-width: 0;
    width: 100%;
    padding: 0 7px;
  }

  body.molecule-home-body .home-direct-card {
    min-height: 108px;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 8px;
    padding: 13px 10px;
  }

  body.molecule-home-body .home-direct-icon {
    width: 36px;
    height: 36px;
  }

  body.molecule-home-body .home-direct-copy strong {
    font-size: 13px;
  }

  body.molecule-home-body .home-direct-copy span {
    font-size: 10.5px;
  }

  body.ms-page .fenzishu-brand-tagline,
  .community-unified-header .fenzishu-brand-tagline {
    display: none !important;
  }

  body.ms-page .fenzishu-brand,
  .community-unified-header .fenzishu-brand {
    width: 116px;
    grid-template-columns: 116px;
  }

  .community-header-actions {
    gap: 5px;
  }

  .community-notification-link,
  .community-account-menu > summary,
  .community-mobile-menu > summary {
    min-height: 40px;
  }
}

@media (max-width: 359px) {
  body.molecule-home-body .molecule-route-view[data-route-view="custom"],
  body.molecule-home-body .molecule-route-view[data-route-view="manual"],
  body.molecule-home-body .home-direct-rail {
    grid-template-columns: minmax(0, 1fr);
  }

  .fenzishu-brand {
    width: 116px;
    grid-template-columns: 116px;
  }

  .fenzishu-brand-tagline {
    display: none !important;
  }
}
/* Opportunity pages use the retained workspace shell (business-layer=0).
   Its desktop rail margin must not push mobile content behind overflow:hidden. */
@media (max-width: 900px) {
  body.vnext-portal.vnext-supply[data-vnext-module="opportunities"] main.opc-shell {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
}
