/* HUIDI R6.17.7.6 · desktop shell stability + product composition/BOM density closure.
   This file is intentionally loaded last so historical tablet/layout rules cannot re-open
   the fixed-sidebar overlap seen at normal desktop browser zoom. */

/* Desktop shell: one geometry source of truth. */
@media (min-width:821px){
  body.cui-app:not(.template-studio-page){--sidebar-width:232px!important}
  body.cui-app:not(.template-studio-page) .cui-sidebar.v070-sidebar{
    width:var(--sidebar-width)!important;
    transform:none!important;
  }
  body.cui-app:not(.template-studio-page) .cui-wrapper{
    margin-left:var(--sidebar-width)!important;
    width:calc(100vw - var(--sidebar-width))!important;
    max-width:calc(100vw - var(--sidebar-width))!important;
    min-width:0!important;
  }
  body.cui-app:not(.template-studio-page) .cui-header,
  body.cui-app:not(.template-studio-page) .cui-main{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }
  body.cui-app:not(.template-studio-page) .cui-main{margin-inline:0!important;overflow:visible!important}
  .sidebar-collapsed body.cui-app:not(.template-studio-page){--sidebar-width:76px!important}
  .sidebar-collapsed body.cui-app:not(.template-studio-page) .cui-sidebar.v070-sidebar{width:76px!important}
  .sidebar-collapsed body.cui-app:not(.template-studio-page) .cui-wrapper{
    margin-left:76px!important;
    width:calc(100vw - 76px)!important;
    max-width:calc(100vw - 76px)!important;
  }
  .sidebar-collapsed .cui-wrapper{margin-left:76px!important;width:calc(100vw - 76px)!important;max-width:calc(100vw - 76px)!important}
}

/* R6.16.83/R5.3 contained an 821-1000px tablet rule that could set wrapper margin-left:0
   while later desktop rules kept the sidebar visible.  Keep desktop geometry coherent. */
@media (min-width:821px) and (max-width:1000px){
  body.cui-app:not(.template-studio-page) .cui-sidebar,
  body.cui-app:not(.template-studio-page) .v070-sidebar{
    transform:none!important;
    width:232px!important;
    box-shadow:none!important;
  }
  body.cui-app:not(.template-studio-page) .cui-wrapper{
    margin-left:232px!important;
    width:calc(100vw - 232px)!important;
    max-width:calc(100vw - 232px)!important;
  }
  body.cui-app:not(.template-studio-page) .cui-header{padding-inline:14px!important}
  body.cui-app:not(.template-studio-page) .cui-main{padding:14px!important}
  body.cui-app:not(.template-studio-page) .mobile-only{display:none!important}
  body.cui-app:not(.template-studio-page) .desktop-only{display:inline-grid}
}

@media (min-width:821px) and (max-width:1120px){
  .v070-header-tools .user-chip{display:none!important}
  .v070-global-search{width:min(310px,42vw)!important}
  .r616-header-button b{display:none}
}

/* Sidebar can still scroll when a role has many navigation entries, but no second visible
   scrollbar competes with the page scrollbar. */
.cui-sidebar-nav,.v070-nav{scrollbar-width:none}
.cui-sidebar-nav::-webkit-scrollbar,.v070-nav::-webkit-scrollbar{width:0;height:0}

/* Product composition/BOM page: dense, scan-first, no oversized empty cards. */
.bom-page-simple{
  max-width:none!important;
  width:100%;
  margin:0!important;
  padding:0 0 52px!important;
  gap:10px!important;
}
.bom-context-strip-r61771{
  grid-template-columns:auto minmax(0,1fr) auto!important;
  gap:10px!important;
  padding:10px 12px!important;
  margin:0!important;
  border-radius:14px!important;
}
.bom-context-back{font-size:12px;line-height:1.35}
.bom-context-product{gap:10px!important}
.bom-context-thumb{width:58px!important;height:58px!important;border-radius:10px!important}
.bom-context-product h2{font-size:18px!important;margin:1px 0 2px!important}
.bom-context-product p{font-size:12px;line-height:1.35}
.bom-context-product small{font-size:11px;line-height:1.35}
.bom-context-actions{gap:6px!important}
.bom-context-actions .btn{min-height:34px;padding:7px 10px;font-size:12px}

.bom-cost-compact.is-empty{margin:0!important;padding:0!important;border-radius:11px!important}
.r61776-cost-status{
  min-height:44px;
  padding:8px 11px;
  align-items:center!important;
  gap:12px!important;
}
.r61776-cost-status span{display:flex!important;align-items:baseline;gap:9px!important;min-width:0}
.r61776-cost-status strong{font-size:12px;white-space:nowrap}
.r61776-cost-status small{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.r61776-cost-status .text-link{font-size:11px;white-space:nowrap}

.r61776-basis-guide{
  margin:0!important;
  min-height:36px;
  padding:7px 10px!important;
  align-items:center!important;
  border-radius:9px!important;
  font-size:11px!important;
  line-height:1.45;
}
.r61776-basis-guide strong{white-space:nowrap;font-size:11px}
.r61776-basis-guide span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.bom-group-list{gap:10px!important}
.bom-group-card{border-radius:14px!important}
.bom-group-card>header{padding:11px 14px!important;min-height:54px}
.bom-group-card>header h3{font-size:15px;margin-bottom:2px!important}
.bom-group-card>header p{font-size:11px;line-height:1.35}
.bom-group-card>header .btn{min-height:32px;padding:6px 9px;font-size:11px}
.bom-item-card-list{min-width:0}
.r61776-bom-row{
  grid-template-columns:52px minmax(280px,720px) minmax(92px,118px) auto!important;
  justify-content:start;
  align-items:center!important;
  column-gap:12px!important;
  row-gap:6px!important;
  min-height:72px;
  padding:9px 14px 9px calc(14px + min(var(--depth),4)*16px)!important;
}
.r61776-bom-row .bom-item-image{width:52px!important;height:52px!important;border-radius:8px!important}
.r61776-bom-row .bom-image-source-pill{font-size:8px!important;padding:1px 4px!important}
.r61776-bom-row .bom-item-main{min-width:0}
.r61776-bom-row .bom-item-main h4{font-size:14px!important;line-height:1.35}
.r61776-bom-row .bom-item-main p{margin:2px 0 5px!important;font-size:11px;line-height:1.35;color:var(--fp-muted)}
.r61776-bom-row .bom-item-meta{gap:4px 11px!important;font-size:11px!important;line-height:1.35}
.r61776-bom-row .bom-item-cost{text-align:left!important;align-content:center;gap:1px}
.r61776-bom-row .bom-item-cost small{font-size:9px;color:var(--fp-muted)}
.r61776-bom-row .bom-item-cost strong{font-size:15px!important;line-height:1.2}
.r61776-bom-row>.btn{min-height:31px;padding:5px 8px;font-size:11px;justify-self:start}

.bom-page-simple>*{min-width:0!important;max-width:100%!important}
.bom-advanced-table.r61776-low-frequency{min-width:0!important;width:100%!important;max-width:100%!important;overflow:hidden!important}
.bom-advanced-table.r61776-low-frequency .bom-advanced-table-body{min-width:0!important;max-width:100%!important}
.bom-advanced-table.r61776-low-frequency .bom-table-scroll{min-width:0!important;max-width:100%!important;overflow-x:auto!important}
.bom-advanced-table.r61776-low-frequency .bom-clean-table{min-width:1040px!important}
.r61776-low-frequency{border-radius:11px!important;margin:0!important}
.r61776-low-frequency>summary{min-height:48px!important;padding:9px 12px!important;align-items:center!important}
.r61776-low-frequency>summary span{gap:1px!important}
.r61776-low-frequency>summary strong{font-size:12px!important}
.r61776-low-frequency>summary small{font-size:10px!important;line-height:1.35}
.r61776-low-frequency>summary i{font-size:11px!important}
.r61776-low-frequency[open]>summary{border-bottom:1px solid var(--fp-border)}

@media (min-width:821px) and (max-width:1180px){
  .bom-context-strip-r61771{grid-template-columns:auto minmax(0,1fr)!important;align-items:start!important}
  .bom-context-actions{grid-column:2;justify-content:flex-start!important}
  .r61776-bom-row{grid-template-columns:48px minmax(240px,1fr) 100px auto!important}
  .r61776-basis-guide span{white-space:normal}
}
@media (min-width:821px) and (max-width:960px){
  .r61776-bom-row{grid-template-columns:48px minmax(220px,1fr) auto!important}
  .r61776-bom-row .bom-item-cost{grid-column:2}
  .r61776-bom-row>.btn{grid-column:3;grid-row:1/3}
  .r61776-cost-status{align-items:flex-start!important}
  .r61776-cost-status span{display:grid!important;gap:2px!important}
  .r61776-cost-status small{white-space:normal}
}
