/* 万鸟朝电脑端区块间距：主要区块 12px，相关控件行 8px。
 * Only named layout containers. Business logic, card internals and mobile stay intact.
 */
@media(min-width:769px){
  html body #page-houses .hp2-head,
  html body #page-houses .ym-stats-bar,
  html body #page-houses .ym-filter-bar,
  html body #page-vacant :is(.sf-mode-tabs,.vc-stats-bar,.vc-filter-bar,.sf-header,.dp-stats,.dp-filter-row){margin-top:0!important;margin-bottom:12px!important}
  html body #page-houses .ym-filter-row,
  html body #page-vacant .vc-filter-row{row-gap:8px!important}
  html body #page-vacant .sf2-body{row-gap:12px!important}

  html body #page-tickets #tickets-container :is(.title-line,.tk-page-tabs,.tk-stats){margin-bottom:12px!important}
  html body #page-tickets #tickets-container :is(.tk-ui-pool-layout,.tk-content-area,.tk-zone-layout){row-gap:12px!important}

  html body #page-customer-center #customer-center-container :is(.cui-heading,.cc-stats6,.cc-search){margin-bottom:12px!important}
  html body #page-customer-center #customer-center-container .cc-search{row-gap:8px!important}
  html body #page-customer-center #customer-center-container .cc-d-stats{margin-top:12px!important}
  html body #page-customer-center #customer-center-container .cc-shell{row-gap:12px!important}

  html body #page-organization #org-container :is(.ov-page-head,.org-tab-bar,.orgu-summary,.orgu-toolbar,.ov-detail-head){margin-bottom:12px!important}
  html body #page-organization #org-container :is(.orgu-toolbar,.orgu-filters){row-gap:8px!important}
  html body #page-organization #org-container :is(.orgc3-layout,.ov-role-layout,.ov-team-layout){row-gap:12px!important}

  html body #page-contracts #contracts-container .ctv-desktop-revision{padding-top:0!important}
  html body #page-contracts #contracts-container :is(.ctv-category-nav,.contracts-glass-header){margin-bottom:12px!important}
  html body #page-contracts #contracts-container .contracts-search-row{row-gap:8px!important}

  html body #page-renovation #renovation-root :is(.rov-center-tabs,.rov-stats,.rov-filterbar,.rov-analysis-grid,.rov-recent-panel,.rpj-stats,.rpj-filter,.rpg-stats,.rpc-topbar,.rpc-stats,.reno-tabs,.reno-card,.reno-warning){margin-bottom:12px!important}
  html body #page-renovation #renovation-root :is(.rov-analysis-grid,.rov-bottom-grid,.rb-columns,.rpg-engineering,.rpc-layout){row-gap:12px!important}
  html body #page-renovation #renovation-root :is(.rpj-filter-row,.rov-filterbar){row-gap:8px!important}
  html body #page-renovation #renovation-root .reno-toolbar{margin-top:8px!important;margin-bottom:12px!important}

  html body #page-wallet #wallet-container :is(.fov-heading,.fov-nav-row,.fov-filter-row,.fps-heading,.fps-tabs,.fps-filter-panel,.fao-heading,.fao-funds-tabs,.fao-account-tabs,.fao-coverage,.fao-filter-panel,.fao-stats,.r3-secnav,.df3-sum){margin-bottom:12px!important}
  html body #page-wallet #wallet-container :is(.fov-core-grid,.fov-mini-grid,.fov-middle,.fov-bottom,.fps-main,.fao-filter-grid,.fao-stats){row-gap:12px!important}
  html body #page-wallet #wallet-container :is(.fov-filter-row,.fps-search-toolbar,.fao-base-fields){row-gap:8px!important}
  html body #page-wallet #wallet-nav-bar{margin-bottom:12px!important}
  html body #page-wallet #wallet-nav-bar>div{margin-bottom:0!important}

  html body #page-mall #mall-container .mh-merchant-tabs{margin-bottom:12px!important}
  html body #page-mall #mall-container :is(.mh-layout,.mh-main,.mh-aside){row-gap:12px!important}
  html body #page-devices #devices-container :is(.dm-wrap,.dov){row-gap:12px!important}

  html body #page-users :is(.pt-tabs,.ai-sugg,.ps-selector,.pkpi-wrap,.action-row,.trend-card){margin-bottom:12px!important}
  html body #page-users .compare-section{margin-top:12px!important}
  html body #page-settings #settings-container :is(.stg-searchbar,.stg-chipsrow,.stg-groups,.stg-legend,.ov-settings-sms){margin-top:12px!important}
  html body #page-settings #settings-container .stg-ghead{margin-top:12px!important;margin-bottom:8px!important}
  html body #page-settings #settings-container .stg-groups>.stg-ghead:first-child{margin-top:0!important}
  html body #page-settings #settings-container .stg-note{margin-top:8px!important}

  /* Same-origin independent sales and boss pages load this sheet themselves. */
  html body .sp-content :is(.sc-heading,.sales-tabs){margin-bottom:12px!important}
  html body .sp-content :is(#tab-order,#tab-leads,#tab-rank,#tab-team,#tab-comm,#tab-mine)>.dash-card{margin-bottom:12px!important}
  html body :is(.boss-hero,.ai-summary){margin-bottom:12px!important}

  /* Shared customer-service header is used by all seven PC pages. */
  html body.cs-header-ready[data-live-device="pc"]{--cs-content-gap:12px}
  html body.cs-header-ready[data-live-device="pc"] .cs-shared-controls{margin-bottom:12px!important}
  html body.cs-header-ready[data-live-device="pc"] :is(.runtime-layout,.lower-grid,.dashboard-grid,.left-dashboard,.human-workspace,.business-workspace){row-gap:12px!important}
  html body.cs-header-ready[data-live-device="pc"] .runtime-stats{margin-bottom:12px!important}
  html body.cs-header-ready[data-live-device="pc"] .business-toolbar{margin-bottom:12px!important;row-gap:8px!important}
}
@media(min-width:1024px){
  /* Dashboard uses a grid: keep a single gutter, rather than grid + card margins. */
  html body #page-dashboard .page-content{row-gap:12px!important}
  html body #page-dashboard .dash-section{margin-bottom:0!important}
}

@media(min-width:769px){
 html body main #page-vacant>.page-content>.sf-mode-tabs,
 html body main #page-vacant #vc-stats-bar{margin-bottom:12px!important}
 html body main #page-users :is(#pt-tabs,#ps-selector,#pkpi-wrap){margin-bottom:12px!important}
 html body .spp .sp-content :is(#tab-order,#tab-leads,#tab-rank,#tab-team,#tab-comm,#tab-mine)>.dash-card{margin-bottom:12px!important}
}

@media(min-width:1024px){
 html body #page-dashboard .page-content.dash-page-content>.wnc-module-title-line{margin-bottom:0!important}
}

/* Secondary navigation follows statistics. Primary navigation and live DOM stay intact. */
@media(min-width:769px){
  /* Financial list filters contain their secondary type/status tabs. */
  html body #finance-v2-bills-root[data-bv-mounted],
  html body .fpv2-page,
  html body .f4r.rv-page,
  html body .sv-root,
  html body .rc-root:has(>.rc-kpis),
  html body #p6-root.pv-root:has(>#p6-body>.pv-kpis){display:flex!important;flex-direction:column;min-width:0}
  html body #finance-v2-bills-root[data-bv-mounted]>.bv-kpis,
  html body .fpv2-page>.fpv2-kpis,
  html body .f4r.rv-page>.rv-kpis,
  html body .sv-root>.sv-kpis,
  html body .rc-root>.rc-kpis{order:-1;margin-top:0!important;margin-bottom:12px!important}
  html body .sv-root>.sv-nav,
  html body .rc-root>.rc-head{order:0}
  html body .sv-root>:not(.sv-kpis):not(.sv-nav),
  html body .rc-root:has(>.rc-kpis)>:not(.rc-kpis):not(.rc-head){order:1}
  html body #p6-root.pv-root:has(>#p6-body>.pv-kpis)>#p6-body{display:contents!important}
  html body #p6-root.pv-root>.pv-subtabs{order:0}
  html body #p6-root.pv-root:has(>#p6-body>.pv-kpis)>:not(.pv-subtabs):not(#p6-body),
  html body #p6-root.pv-root>#p6-body>*{order:1}
  html body #p6-root.pv-root>#p6-body>.pv-kpis{order:-1;margin-top:0!important;margin-bottom:12px!important}

  /* Account subnavigation lives outside an independently refreshed data body. */
  html body #funds-account-overview:has(>#fao-body),
  html body #funds-subject-page,
  html body #funds-payout-center{display:flex!important;flex-direction:column;min-width:0}
  html body #funds-account-overview>#fao-body,
  html body #funds-subject-page>#fs-body{display:contents!important}
  html body #funds-account-overview>*,
  html body #funds-account-overview>#fao-body>*,
  html body #funds-subject-page>*,
  html body #funds-subject-page>#fs-body>*,
  html body #funds-payout-center>*{order:4}
  html body :is(#funds-account-overview,#funds-subject-page)>.fao-heading,
  html body #funds-payout-center>.heading{order:0}
  html body :is(#funds-account-overview,#funds-subject-page)>.fao-funds-tabs,
  html body #funds-payout-center>.center-tabs{order:1}
  html body #funds-account-overview>#fao-body>.fao-stats,
  html body #funds-subject-page>#fs-body>.fs-stats,
  html body #funds-payout-center>.po-stat-grid{order:2;margin-top:0!important;margin-bottom:12px!important}
  html body :is(#funds-account-overview,#funds-subject-page)>.fao-account-tabs,
  html body #funds-payout-center>.po-main-tabs{order:3;margin-bottom:12px!important}

  /* Device analysis has statistics on its overview only. */
  html body #devices-container .dai:has(>.dai-stats){display:flex!important;flex-direction:column;min-width:0}
  html body #devices-container .dai>.dai-stats{order:-1;margin-top:0!important;margin-bottom:12px!important}

  /* Independent sales iframe: keep hidden views hidden and existing handlers in place. */
  html body .sp-content:has(>#sc-comm-nav[style*="flex"]):has(>#tab-comm[style*="block"] .cv2-kpis-group:not([style*="none"])){display:flex!important;flex-direction:column}
  html body .sp-content:has(>#sc-comm-nav[style*="flex"]):has(>#tab-comm[style*="block"] .cv2-kpis-group:not([style*="none"]))>.sc-heading{order:-3}
  html body .sp-content:has(>#sc-comm-nav[style*="flex"]):has(>#tab-comm[style*="block"] .cv2-kpis-group:not([style*="none"]))>.sales-tabs{order:-2}
  html body .sp-content:has(>#sc-comm-nav[style*="flex"]):has(>#tab-comm[style*="block"] .cv2-kpis-group:not([style*="none"]))>#tab-comm{display:contents!important}
  html body .sp-content:has(>#sc-comm-nav[style*="flex"]):has(>#tab-comm[style*="block"] .cv2-kpis-group:not([style*="none"]))>#tab-comm>.cv2-kpis-group{order:-1;margin-bottom:12px!important}
  html body .sp-content:has(>#sc-comm-nav[style*="flex"]):has(>#tab-comm[style*="block"] .cv2-kpis-group:not([style*="none"]))>#sc-comm-nav{order:0}
  html body .sp-content:has(>#sc-comm-nav[style*="flex"]):has(>#tab-comm[style*="block"] .cv2-kpis-group:not([style*="none"]))>#tab-comm>:not(.cv2-kpis-group){order:1}
  html body #tab-team[style*="block"]:has(>#sc-team-kpis){display:flex!important;flex-direction:column}
  html body #tab-team>#sc-team-kpis{order:-1;margin-top:0!important;margin-bottom:12px!important}
  html body #tab-mine[style*="block"]:has(>#sc-mine-view>.sx-mine>.sx-mine-kpis){display:flex!important;flex-direction:column}
  html body #tab-mine:has(>#sc-mine-view>.sx-mine>.sx-mine-kpis)>#sc-mine-view,
  html body #tab-mine:has(>#sc-mine-view>.sx-mine>.sx-mine-kpis)>#sc-mine-view>.sx-mine{display:contents!important}
  html body #tab-mine>#sc-mine-view>.sx-mine>.sx-mine-kpis{order:-1;margin-bottom:12px!important}
  html body #tab-mine>#sc-mine-nav{order:0}
  html body #tab-mine>.sx-mine-heading-controls,
  html body #tab-mine>.sx-mine-search{order:1}
  html body #tab-mine>#sc-mine-view>.sx-mine>.sx-mine-columns{order:2}
}

/* Keep one 12px gutter when the former grid becomes a column. */
@media(min-width:769px){
 html body #finance-v2-bills-root[data-bv-mounted],html body .fpv2-page,html body .f4r.rv-page{gap:12px!important}
 html body #finance-v2-bills-root[data-bv-mounted]>*:not([hidden]),html body .fpv2-page>*,html body .f4r.rv-page>*{margin-top:0!important;margin-bottom:0!important}
 html body #devices-container .dai:has(>.dai-stats)>.dai-stats{margin-bottom:0!important}
 html body #devices-container .dai:has(>.dai-stats)>:not(.dai-stats):not(.dai-topline){order:1}
}

@media(min-width:769px){
 html body .sp-content:has(>#sc-comm-nav[style*="flex"]):has(>#tab-comm[style*="block"] .cv2-kpis-group:not([style*="none"]))>#tab-comm>.cv2-kpis-group{margin-bottom:0!important}
 html body .sp-content:has(>#sc-comm-nav[style*="flex"]):has(>#tab-comm[style*="block"] .cv2-kpis-group:not([style*="none"])) .cv2-kpis-group>.cv2-kpis{margin-bottom:0!important}
 html body .sp-content:has(>#sc-comm-nav[style*="flex"]):has(>#tab-comm[style*="block"] .cv2-kpis-group:not([style*="none"]))>#sc-comm-nav{margin:12px 0!important}
 html body #tab-team[style*="block"]:has(>#sc-team-kpis)>.sales-ui-team-tabs{order:0;margin-top:0!important;margin-bottom:12px!important}
 html body #tab-team[style*="block"]:has(>#sc-team-kpis)>.sales-ui-team-filter{order:1}
 html body #tab-team[style*="block"]:has(>#sc-team-kpis)>#sales-ui-team-body{order:2}
}

/* 录入统计：顶部 Tab → 统计 → 搜索/筛选 → 原有图表。PC only. */
@media(min-width:769px){
  html body #page-house-intake #ik-root{
    display:grid!important;grid-template-columns:160px minmax(0,1fr);
    column-gap:8px;row-gap:12px;min-width:0;
  }
  html body #page-house-intake #ik-root > *{
    grid-column:1 / -1;margin-top:0!important;margin-bottom:0!important;min-width:0;
  }
  html body #page-house-intake #ik-root > #ik-kpi{grid-row:1}
  html body #page-house-intake #ik-root > .ik-search{
    grid-row:2;grid-column:1;height:36px;padding:0 9px;gap:6px;box-sizing:border-box;align-self:start;
  }
  html body #page-house-intake #ik-root > .ik-search input{width:0;min-width:0;font-size:12px}
  html body #page-house-intake #ik-root > .ik-filterline{
    grid-row:2;grid-column:2;gap:4px;overflow:visible;min-width:0;
  }
  html body #page-house-intake #ik-root .ik-filterline > :is(.ik-date,.ik-sel,.ik-btn){
    height:36px;box-sizing:border-box;flex:0 0 auto;
  }
  html body #page-house-intake #ik-root .ik-date{padding:0 7px}
  html body #page-house-intake #ik-root .ik-date svg,
  html body #page-house-intake #ik-root .ik-fdiv,
  html body #page-house-intake #ik-root #ik-refresh svg{display:none}
  html body #page-house-intake #ik-root .ik-seg{height:36px;box-sizing:border-box;flex:0 0 auto}
  html body #page-house-intake #ik-root .ik-seg button{padding:0 5px}
  html body #page-house-intake #ik-root .ik-sel{padding:0 20px 0 7px;background-position:right 6px center;min-width:0}
  html body #page-house-intake #ik-root #ik-company,
  html body #page-house-intake #ik-root #ik-area,
  html body #page-house-intake #ik-root #ik-store{width:78px}
  html body #page-house-intake #ik-root #ik-package,
  html body #page-house-intake #ik-root #ik-owner{width:90px}
  html body #page-house-intake #ik-root #ik-refresh{padding:0 9px;margin-left:0!important}
}
@media(min-width:769px) and (max-width:1199px){
  html body #page-house-intake #ik-root{grid-template-columns:160px minmax(0,1fr)}
  html body #page-house-intake #ik-root > .ik-filterline{flex-wrap:wrap;row-gap:8px}
}

/* 录入统计卡片复用桌面统计标准：去掉 .kl 重复纵向内边距。 */
@media(min-width:769px){
  html body #page-house-intake #ik-root #ik-kpi > .ik-kpi-card{align-items:center;gap:10px}
  html body #page-house-intake #ik-root #ik-kpi .kl{padding:0;align-self:center}
  html body #page-house-intake #ik-root #ik-kpi .ki{
    flex:0 0 32px;width:32px;height:36px;font-size:20px;line-height:1;align-self:center;
  }
  html body #page-house-intake #ik-root #ik-kpi .lb{
    font-size:12px;line-height:18px;font-weight:600;margin:0;
  }
  html body #page-house-intake #ik-root #ik-kpi .vl{
    font-size:23px;line-height:29px;font-weight:600;white-space:nowrap;margin:2px 0;
  }
  html body #page-house-intake #ik-root #ik-kpi .vl small{font-size:11px;line-height:16px}
  html body #page-house-intake #ik-root #ik-kpi .dt{font-size:10px;line-height:14px;font-weight:400;margin:1px 0 0}
  html body #page-house-intake #ik-root #ik-kpi .kr{flex:0 0 56px;padding-right:0;align-self:center}
  html body #page-house-intake #ik-root #ik-kpi .kr .ik-spark{width:56px;height:28px}
  html body #page-house-intake #ik-root #ik-kpi .kr .ik-ring{width:48px;height:48px}
}
@media(min-width:769px) and (max-width:1300px){
  html body #page-house-intake #ik-root #ik-kpi .ki{flex-basis:26px;width:26px;height:30px}
  html body #page-house-intake #ik-root #ik-kpi .vl{font-size:21px;line-height:27px}
  html body #page-house-intake #ik-root #ik-kpi .lb{font-size:11px;line-height:16px}
}
