/* 恒链BI V239
   利润分析滚动架构按旧BI重做：
   - 顶部系统栏 / 页签 / 墨西哥时间日期栏都在 app-main 外；
   - app-main 是唯一业务纵向滚动区；
   - KPI、商品工具栏、真实表头全部使用原 DOM 的 sticky，不再克隆；
   - 窄窗口时表格自身无横向滚动条，只使用底部固定横向代理条；
   - 底部分页固定，尺寸参考订单管理/旧BI。
   仅调整利润分析展示与交互，不改财务口径/API/MySQL。
*/

/* =========================================================
   1. 先恢复旧BI的页面滚动层级：只有 app-main 一条纵向滚动条
   ========================================================= */
html.hl-profit-oldbi-v239,
html.hl-profit-oldbi-v239 body,
html.hl-profit-oldbi-v239 #root,
html.hl-profit-oldbi-v239 .uranus-shell{
  height:100%!important;
  max-height:100vh!important;
  overflow:hidden!important;
}
html.hl-profit-oldbi-v239 .app-body{
  height:100vh!important;
  min-height:0!important;
  overflow:hidden!important;
}
body.hl-analysis-v166-profit .page-column{
  height:calc(100vh - 50px)!important;
  max-height:calc(100vh - 50px)!important;
  min-height:0!important;
  width:100%!important;
  display:flex!important;
  flex-direction:column!important;
  overflow:hidden!important;
}

/* 顶部页签：网页头的一部分，不参与正文滚动；同时彻底取消横向滚动条。 */
body.hl-analysis-v166-profit .page-column > .tabs-line{
  position:relative!important;
  top:auto!important;
  left:auto!important;
  right:auto!important;
  flex:0 0 42px!important;
  width:100%!important;
  min-width:0!important;
  overflow:hidden!important;
  overflow-x:hidden!important;
  overflow-y:hidden!important;
  scrollbar-width:none!important;
  -ms-overflow-style:none!important;
  z-index:30!important;
  background:#fff!important;
}
body.hl-analysis-v166-profit .page-column > .tabs-line::-webkit-scrollbar{display:none!important;width:0!important;height:0!important}

/* 公共“墨西哥时间/日期”栏移动到 tabs-line 与 app-main 之间，成为真正网页头。 */
body.hl-analysis-v166-profit .page-column > #hl-analysis-global-toolbar-v166.hl-profit-header-v239{
  position:relative!important;
  inset:auto!important;
  top:auto!important;
  left:auto!important;
  right:auto!important;
  flex:0 0 46px!important;
  width:100%!important;
  height:46px!important;
  min-height:46px!important;
  margin:0!important;
  padding:0!important;
  overflow:hidden!important;
  z-index:32!important;
  background:#fff!important;
  border-bottom:1px solid #edf0f4!important;
  box-sizing:border-box!important;
}

/* 唯一纵向滚动区。 */
body.hl-analysis-v166-profit .page-column > .app-main,
body.hl-analysis-v166-profit .app-main{
  position:relative!important;
  flex:1 1 auto!important;
  min-height:0!important;
  height:auto!important;
  max-height:none!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain!important;
  scrollbar-gutter:auto!important;
  -webkit-overflow-scrolling:touch!important;
}

/* 顶部系统栏绝不产生横向滚动条。 */
body.hl-analysis-v166-profit .system-bar{
  overflow:hidden!important;
  overflow-x:hidden!important;
}

/* 禁止前几个版本生成的悬浮层/横条继续残留。 */
body.hl-analysis-v166-profit > [class*="hl-profit-fixed-overlay-v"],
body.hl-analysis-v166-profit > [id^="hl-profit-fixed-hscroll-v23"]:not(#hl-profit-fixed-hscroll-v239),
body.hl-analysis-v166-profit > #hl-fixed-hscroll{
  display:none!important;
}

/* =========================================================
   2. 旧BI比例：摘要/趋势、商品表格列宽/行高/字体
   ========================================================= */
#hl-profit-v189{
  --hl-profit-v239-group-height:122px;
  --hl-profit-v239-toolbar-height:34px;
  --hl-profit-v239-thead-height:34px;
  --hl-profit-v239-footer-height:48px;
  --hl-profit-v239-hscroll-height:16px;
  position:relative!important;
  overflow:visible!important;
}

#hl-profit-v189 .hl-profit-middle{
  min-height:300px!important;
  padding:8px!important;
  margin-bottom:11px!important;
}
#hl-profit-v189 .hl-profit-middle h3{font-size:12px!important;line-height:18px!important;margin:0 0 7px!important}
#hl-profit-v189 .summary-scroll{height:238px!important;overflow:hidden!important}
#hl-profit-v189 .chart-wrap{height:238px!important}
#hl-profit-v189 .chart-empty{height:228px!important}
#hl-profit-v189 .hl-profit-summary table{font-size:11px!important}
#hl-profit-v189 .hl-profit-summary th,
#hl-profit-v189 .hl-profit-summary td{height:30px!important;padding:0 8px!important;font-size:11px!important}
#hl-profit-v189 .chart-legend{height:22px!important;font-size:10.5px!important}
#hl-profit-v189 .chart-wrap .axis text{font-size:9.5px!important}
#hl-profit-v189 .expand-mark{height:22px!important;line-height:22px!important;font-size:10.5px!important}
#hl-profit-v189 .summary-expanded{min-height:438px!important}
#hl-profit-v189 .summary-expanded .summary-scroll{height:auto!important;max-height:none!important;overflow:visible!important}
#hl-profit-v189 .summary-expanded .chart-wrap{height:376px!important}

#hl-profit-v189 .hl-profit-products{
  position:relative!important;
  padding:10px 10px calc(var(--hl-profit-v239-footer-height) + var(--hl-profit-v239-hscroll-height) + 18px)!important;
  overflow:visible!important;
}
#hl-profit-v189 .hl-profit-products h2{font-size:14px!important;line-height:22px!important;margin:0 0 8px!important}

#hl-profit-v189 .product-toolbar{
  min-height:34px!important;
  margin:0!important;
  padding:3px 0!important;
  background:#fff!important;
}
#hl-profit-v189 .group-tabs button{height:28px!important;min-width:66px!important;padding:0 11px!important;font-size:11px!important}
#hl-profit-v189 .product-toolbar select,
#hl-profit-v189 .product-toolbar input,
#hl-profit-v189 .product-toolbar .search button{height:28px!important;font-size:11px!important}
#hl-profit-v189 .product-toolbar select{width:74px!important}
#hl-profit-v189 .product-toolbar input{width:140px!important}
#hl-profit-v189 .product-toolbar .search button{padding:0 12px!important}

/* 表格外框不能成为纵向滚动容器；横向超出由 clip + 底部代理条控制。 */
#hl-profit-v189 .profit-table-wrap{
  position:relative!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  overflow-x:clip!important;
  overflow-y:visible!important;
  border:1px solid #dfe5ec!important;
  box-sizing:border-box!important;
}
#hl-profit-v189 .profit-table{
  display:table!important;
  width:100%!important;
  min-width:0!important;
  table-layout:fixed!important;
  border-collapse:collapse!important;
  font-size:11px!important;
  color:#4f5d6b!important;
  will-change:transform;
}
#hl-profit-v189 .profit-table col:nth-child(1){width:12.839%!important}
#hl-profit-v189 .profit-table col:nth-child(2){width:8.126%!important}
#hl-profit-v189 .profit-table col:nth-child(3){width:6.392%!important}
#hl-profit-v189 .profit-table col:nth-child(4){width:11.430%!important}
#hl-profit-v189 .profit-table col:nth-child(5){width:11.484%!important}
#hl-profit-v189 .profit-table col:nth-child(6){width:11.484%!important}
#hl-profit-v189 .profit-table col:nth-child(7){width:12.730%!important}
#hl-profit-v189 .profit-table col:nth-child(8){width:12.730%!important}
#hl-profit-v189 .profit-table col:nth-child(9){width:12.785%!important}

#hl-profit-v189 .profit-table th{
  height:34px!important;
  padding:0 6px!important;
  font-size:11.5px!important;
  line-height:16px!important;
  font-weight:600!important;
  vertical-align:middle!important;
  text-align:center!important;
  white-space:nowrap!important;
  background:#fff!important;
  border-right:1px solid #e1e7ed!important;
  border-bottom:1px solid #d9e1e8!important;
}
#hl-profit-v189 .profit-table td{
  height:136px!important;
  padding:7px 8px!important;
  font-size:10.5px!important;
  line-height:15px!important;
  vertical-align:top!important;
  border-right:1px solid #e1e7ed!important;
  border-bottom:1px solid #e1e7ed!important;
}
#hl-profit-v189 .profit-table tbody tr:nth-child(odd) td{background:#fff!important}
#hl-profit-v189 .profit-table tbody tr:nth-child(even) td{background:#fbfcfd!important}
#hl-profit-v189 .hl-profit-store-cell,
#hl-profit-v189 .hl-profit-status-cell{vertical-align:middle!important;text-align:center!important;font-size:10.5px!important}
#hl-profit-v189 .status{font-size:10px!important;line-height:17px!important;padding:1px 6px!important}
#hl-profit-v189 .product-box{gap:7px!important;align-items:flex-start!important}
#hl-profit-v189 .product-box img{width:46px!important;height:46px!important;flex:0 0 46px!important;object-fit:contain!important}
#hl-profit-v189 .product-title{max-width:165px!important;font-size:10.8px!important;line-height:16px!important;margin-bottom:2px!important}
#hl-profit-v189 .product-box small{max-width:165px!important;font-size:9.8px!important;line-height:14px!important;margin-bottom:2px!important}
#hl-profit-v189 .product-box p{margin:1px 0!important;max-width:165px!important;font-size:9.8px!important;line-height:14px!important}
#hl-profit-v189 .copy{font-size:9px!important}
#hl-profit-v189 .hl-profit-detail-cell>div{
  display:flex!important;align-items:flex-start!important;justify-content:space-between!important;gap:5px!important;
  min-height:15px!important;line-height:15px!important;font-size:10.2px!important;white-space:nowrap!important;
}
#hl-profit-v189 .hl-profit-detail-cell>div span{flex:1 1 auto!important;min-width:0!important;color:#687584!important}
#hl-profit-v189 .hl-profit-detail-cell>div b{flex:0 0 auto!important;margin-left:4px!important;color:#394a5c!important;font-size:10.2px!important;line-height:15px!important;font-weight:500!important;text-align:right!important}
#hl-profit-v189 .hl-profit-detail-cell .hl-profit-help-mark-v189{width:12px!important;height:12px!important;min-width:12px!important;font-size:8px!important;line-height:10px!important;margin-left:2px!important}

/* 窄窗口时保留旧BI列宽，不挤坏字段；横向查看交给底部代理条。 */
@media(max-width:1500px){
  #hl-profit-v189 .profit-table{width:1500px!important;min-width:1500px!important}
}

/* =========================================================
   3. KPI：到位后真实DOM fixed；工具栏 / 真实表头继续使用真实DOM sticky
   ========================================================= */
#hl-profit-v189 .hl-profit-sticky-spacer-v239{
  display:block!important;
  width:100%!important;
  height:0;
  margin:0!important;
  padding:0!important;
  border:0!important;
  pointer-events:none!important;
}
#hl-profit-v189 .hl-profit-sticky-group-v239{
  position:relative!important;
  top:auto!important;
  z-index:120!important;
  width:100%!important;
  margin:0!important;
  padding:0 0 8px!important;
  box-sizing:border-box!important;
  background:#f2f5f9!important;
  isolation:isolate!important;
  box-shadow:0 2px 4px rgba(25,45,75,.08)!important;
}
#hl-profit-v189 .hl-profit-sticky-group-v239.is-fixed-v239{
  position:fixed!important;
  margin:0!important;
  box-sizing:border-box!important;
}
#hl-profit-v189 .hl-profit-sticky-group-v239 .hl-profit-kpis{position:static!important;margin:0 0 7px!important;background:#f2f5f9!important}
#hl-profit-v189 .hl-profit-sticky-group-v239 .hl-profit-viewtabs{position:static!important;margin:0!important;background:#fff!important}
#hl-profit-v189 .hl-profit-sticky-group-v239 .hl-profit-metricstrip,
#hl-profit-v189 .hl-profit-sticky-group-v239 .hl-profit-store-strip,
#hl-profit-v189 .hl-profit-sticky-group-v239 .hl-profit-store-empty{position:static!important;margin:0!important;background:#fff!important}

/* 工具栏先正常跟页面走；只有自然滚到 KPI 下方才 sticky。 */
#hl-profit-v189 .product-toolbar.hl-profit-real-toolbar-v239{
  position:sticky!important;
  top:var(--hl-profit-v239-group-height)!important;
  z-index:118!important;
  width:100%!important;
  box-sizing:border-box!important;
  background:#fff!important;
  border-bottom:1px solid #dfe5ec!important;
}

/* 真实表头直接 sticky，不复制、不悬浮第二层。 */
#hl-profit-v189 .profit-table thead.hl-profit-real-thead-v239 th{
  position:sticky!important;
  top:calc(var(--hl-profit-v239-group-height) + var(--hl-profit-v239-toolbar-height))!important;
  z-index:117!important;
  background:#fff!important;
  box-shadow:0 1px 0 rgba(217,225,232,.95)!important;
}

/* KPI ?：按用户指定。实际DOM自带原有提示事件，因此 hover/离开均正常。 */
#hl-profit-v189 .hl-profit-kpis .hl-profit-help-mark-v189{
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  width:15px!important;height:15px!important;min-width:15px!important;margin-left:4px!important;padding:0!important;
  border:1px solid #fff!important;border-radius:50%!important;background:transparent!important;color:#fff!important;
  font-size:10px!important;line-height:13px!important;font-weight:700!important;box-sizing:border-box!important;
  cursor:default!important;transition:background-color .12s ease,color .12s ease,border-color .12s ease!important;
}
#hl-profit-v189 .hl-profit-kpis .hl-profit-help-mark-v189:hover,
#hl-profit-v189 .hl-profit-kpis .hl-profit-help-mark-v189:focus{
  background:#fff!important;color:#59616c!important;border-color:#fff!important;outline:none!important;cursor:default!important;
}

/* =========================================================
   4. 底部分页：固定；横向代理条固定在分页正上方
   ========================================================= */
#hl-profit-v189 .product-footer.hl-profit-real-footer-v239{
  position:fixed!important;
  bottom:0!important;
  z-index:130!important;
  height:48px!important;
  min-height:48px!important;
  padding:0 12px!important;
  margin:0!important;
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  box-sizing:border-box!important;
  background:#fff!important;
  border-top:1px solid #d8e0ea!important;
  box-shadow:0 -2px 8px rgba(28,45,70,.09)!important;
  color:#657283!important;
  font-size:12px!important;
}
#hl-profit-v189 .hl-profit-footer-meta-v239{white-space:nowrap!important;color:#657283!important}
#hl-profit-v189 .hl-profit-pagination-v239{display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:8px!important;white-space:nowrap!important}
#hl-profit-v189 .hl-profit-pagination-v239-size{
  height:28px!important;min-width:86px!important;padding:0 24px 0 9px!important;border:1px solid #dce3eb!important;border-radius:4px!important;background:#fff!important;color:#6c7885!important;font-size:11px!important;
}
#hl-profit-v189 .hl-profit-pagination-v239-nav{display:flex!important;align-items:center!important;gap:4px!important}
#hl-profit-v189 .hl-profit-pagination-v239-nav button{
  min-width:28px!important;width:28px!important;height:28px!important;padding:0!important;border:1px solid #e1e7ed!important;border-radius:2px!important;background:#f7f8fa!important;color:#8e99a6!important;font-size:12px!important;line-height:26px!important;text-align:center!important;
}
#hl-profit-v189 .hl-profit-pagination-v239-nav button.active{background:#269bf0!important;border-color:#269bf0!important;color:#fff!important}
#hl-profit-v189 .hl-profit-pagination-v239-nav button:disabled{opacity:.4!important;cursor:not-allowed!important}
#hl-profit-v189 .hl-profit-pagination-v239-jump{display:flex!important;align-items:center!important;gap:5px!important;font-weight:400!important;color:#657283!important}
#hl-profit-v189 .hl-profit-page-jump-v239{width:42px!important;height:28px!important;padding:0 5px!important;border:1px solid #dce3eb!important;border-radius:3px!important;background:#fff!important;text-align:center!important;color:#657283!important;font-size:11px!important;box-sizing:border-box!important}

body > #hl-profit-fixed-hscroll-v239{
  position:fixed!important;
  z-index:131!important;
  height:16px!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  box-sizing:border-box!important;
  background:#fff!important;
  border-top:1px solid #d8e0ea!important;
  border-bottom:1px solid #d8e0ea!important;
  scrollbar-width:auto!important;
  overscroll-behavior-x:contain!important;
}
body > #hl-profit-fixed-hscroll-v239[hidden]{display:none!important}
body > #hl-profit-fixed-hscroll-v239::-webkit-scrollbar{height:14px!important}
body > #hl-profit-fixed-hscroll-v239::-webkit-scrollbar-track{background:#f2f3f5!important}
body > #hl-profit-fixed-hscroll-v239::-webkit-scrollbar-thumb{background:#9ca6af!important;border-radius:6px!important}
body > #hl-profit-fixed-hscroll-v239 .hl-profit-fixed-hscroll-inner-v239{height:1px!important;min-height:1px!important;pointer-events:none!important}

/* 清除表格自身原生横向滚动条；底部固定代理条是唯一横向控制。 */
#hl-profit-v189 .profit-table-wrap::-webkit-scrollbar{width:0!important;height:0!important;display:none!important}


/* V239 intrinsic-size guard：窄窗口时 1500px 表格只能在表格视口内部超出，不能把 page-column/app-main 撑宽。 */
body.hl-analysis-v166-profit .page-column > .app-main{min-width:0!important}
#hl-profit-v189{width:100%!important;min-width:0!important;max-width:100%!important}
#hl-profit-v189 .hl-profit-products{width:100%!important;min-width:0!important;max-width:100%!important}
#hl-profit-v189 .profit-table-wrap{contain:inline-size!important}
/* app-main 顶部 padding 不参与 sticky 偏移；原来的视觉留白由利润根节点补回。 */
body.hl-analysis-v166-profit .page-column > .app-main{padding-top:0!important}
#hl-profit-v189{margin-top:18px!important}
