/* CPGCBL EMD R11.5.8 - Compact reference refinement.
   Read-only non-Daily-Work drawers only; original images, tables, and handlers stay live. */
body.r107-ui #drawer.r1158-active {
  --r1155-line:rgba(58,100,142,.105);
  --r1155-shadow:none;
}
body.r107-ui[data-theme="dark"] #drawer.r1158-active,
body.r107-ui[data-theme="hybrid"] #drawer.r1158-active,
body.r107-ui[data-theme="slate"] #drawer.r1158-active {
  --r1155-line:rgba(122,175,201,.105);
  --r1155-shadow:none;
}
/* 900px before; 790px now. Internal wide tables scroll, not the entire drawer. */
body.r107-ui #drawer.r1158-active .drawerpanel {
  width:min(790px,calc(100vw - 34px))!important;
  max-width:100vw!important;
  min-width:0!important;
  background:var(--r1155-bg)!important;
}
body.r107-ui #drawer.r1158-active .drawerbody {
  padding:8px 10px 15px!important;
  overflow-x:hidden!important;
}
body.r107-ui #drawer.r1158-active .drawerhead {
  min-height:53px!important;
  padding:7px 10px!important;
}
body.r107-ui #drawer.r1158-active .drawerhead b {font-size:14px!important;line-height:1.22!important;}
body.r107-ui #drawer.r1158-active .drawerhead small {font-size:10px!important;}
#drawer.r1158-active :is(.r1157-shell,.r1157-sections,.r1156-group){gap:6px!important;}
#drawer.r1158-active .r1156-group {min-width:0!important;}
#drawer.r1158-active .r1155-actions {gap:5px!important;}
#drawer.r1158-active .r1155-actions :is(.btn,button) {font-size:11px!important;min-height:30px!important;padding:5px 9px!important;}
#drawer.r1158-active .r1156-group>.detail-hero,
#drawer.r1158-active .r1156-group>.r79-bearing-hero {min-height:30px!important;padding:5px 9px!important;}
#drawer.r1158-active .r1156-group>.detail-hero p {font-size:10.5px!important;}
/* Photo once at the start, naturally sized, with original working thumbnail selection. */
body.r107-ui #drawer.r1158-active .r1157-media-details,
body.r107-ui #drawer.r1158-active .r1156-group-overview>.r79-bearing-top,
body.r107-ui #drawer.r1158-active .r1156-group-overview .r79-bearing-top {
  display:grid!important;
  grid-template-columns:minmax(210px,.82fr) minmax(0,1.18fr)!important;
  align-items:start!important;
  gap:7px!important;
}
#drawer.r1158-active .r1157-media-details>* ,
#drawer.r1158-active .r79-bearing-top>* {min-width:0!important;}
#drawer.r1158-active .r1157-media-details>.r5-drawer-section,
#drawer.r1158-active .r79-bearing-top>.r79-media-card,
#drawer.r1158-active .r79-bearing-top>.r79-spec-card {padding:8px!important;min-height:0!important;border-color:var(--r1155-line)!important;}
#drawer.r1158-active .r1157-photo-card {align-self:start!important;gap:4px!important;}
#drawer.r1158-active :is(.r1157-photo-card,.r79-media-card) .emd-r93-main-photo {
  height:176px!important;min-height:155px!important;max-height:176px!important;
  margin:0!important;background:var(--r1155-alt)!important;
}
#drawer.r1158-active :is(.r1157-photo-card,.r79-media-card) .emd-r93-main-photo img {object-fit:contain!important;}
#drawer.r1158-active :is(.r1157-photo-card,.r79-media-card) .emd-r93-thumb-rail {margin:0!important;gap:4px!important;padding:2px 0!important;}
#drawer.r1158-active :is(.r1157-photo-card,.r79-media-card) .emd-r93-thumb {
  flex:0 0 43px!important;min-width:43px!important;max-width:43px!important;
  width:43px!important;height:40px!important;padding:2px!important;
}
#drawer.r1158-active :is(.r1157-photo-card,.r79-media-card) .emd-r93-gallery {gap:4px!important;}
#drawer.r1158-active .r79-media-card .r79-section-head p {font-size:10px!important;line-height:1.2!important;}
#drawer.r1158-active .r79-media-card .r79-section-head {margin-bottom:5px!important;}
/* Metadata is preserved under the native, collapsed audit details at the end. */
#drawer.r1158-active .r1158-audit-notes {
  padding:7px 9px!important;border:1px solid var(--r1155-line)!important;
  background:var(--r1155-panel)!important;border-radius:8px!important;font-size:11px!important;
}
#drawer.r1158-active .r1158-audit-notes>summary {cursor:pointer;color:var(--r1155-muted)!important;font-weight:700;}
#drawer.r1158-active .r1158-audit-notes[open]>*:not(summary) {margin-top:6px!important;}
#drawer.r1158-active .r1158-audit-notes .r7-image-note {background:transparent!important;border:0!important;padding:4px 0!important;}
/* No fake KPIs: only existing recorded fields; omit visually empty nameplate rows. */
#drawer.r1158-active .r1158-blank-field {display:none!important;}
#drawer.r1158-active .r1157-media-details .r5-detail-grid {gap:0 7px!important;}
#drawer.r1158-active .r1157-media-details .r5-detail {min-height:28px!important;padding:5px 2px!important;}
#drawer.r1158-active .r1157-media-details .r5-detail small {font-size:10.5px!important;}
#drawer.r1158-active .r1157-media-details .r5-detail b {font-size:11.7px!important;}
#drawer.r1158-active .r1157-real-kpis,
#drawer.r1158-active .r1156-metrics {gap:5px!important;}
#drawer.r1158-active .r1157-real-kpis .r5-detail,
#drawer.r1158-active .r1156-metrics>* {min-height:48px!important;padding:6px 8px!important;}
#drawer.r1158-active .r1157-real-kpis .r5-detail b,
#drawer.r1158-active .r1156-metrics>* :is(b,strong,.num) {font-size:15px!important;}
/* Consistent compact sections and subdued borders in both themes. */
#drawer.r1158-active .r1156-group>.r5-drawer-section,
#drawer.r1158-active .r1156-group>.r1155-card,
#drawer.r1158-active .r1156-group>.r79-tech-grid {padding:8px!important;border-color:var(--r1155-line)!important;box-shadow:none!important;}
#drawer.r1158-active .r1156-group .r5-detail {min-height:29px!important;padding:4px 3px!important;}
#drawer.r1158-active .r1156-group :is(.r5-drawer-section h3,.r1155-section-title,.r79-section-head h3) {margin:0 0 5px!important;font-size:12px!important;}
#drawer.r1158-active .r1156-group .r1156-stock-fields .r79-tech-grid {gap:5px!important;}
#drawer.r1158-active .r1156-group .r1156-stock-fields .r79-tech-grid>* {min-height:43px!important;padding:6px!important;}
#drawer.r1158-active .r79-dim-grid>div {padding:5px!important;min-width:0!important;}
#drawer.r1158-active .r79-catalog-copy {margin-top:6px!important;gap:3px!important;}
#drawer.r1158-active .r79-ref-actions {margin-top:7px!important;}
/* Long installed-location or transaction tables scroll within their cards. */
#drawer.r1158-active .r1156-group :is(.tablewrap,.r5-tablewrap) {
  max-height:190px!important;overflow:auto!important;border:1px solid var(--r1155-line)!important;
  min-width:0!important;margin:0!important;
}
#drawer.r1158-active .r1156-group :is(.table,.r5-table) {min-width:570px!important;}
#drawer.r1158-active .r1156-group :is(.table,.r5-table) :is(th,td) {font-size:11px!important;line-height:1.3!important;padding:5px 6px!important;}
#drawer.r1158-active .r1156-group :is(.table,.r5-table) thead th {position:sticky;top:0;z-index:1;background:var(--r1155-alt)!important;}
#drawer.r1158-active .r1158-empty-table {height:auto!important;min-height:0!important;max-height:82px!important;overflow:hidden!important;}
#drawer.r1158-active .r1158-empty-table table {min-width:100%!important;}
#drawer.r1158-active .r1158-empty-table tbody tr {height:auto!important;}
#drawer.r1158-active .r1158-empty-table td {height:auto!important;min-height:0!important;padding:10px 8px!important;}
#drawer.r1158-active .r1156-group-stock td:has(> button),
#drawer.r1158-active .r1156-group-stock td:has(> .btn) {min-width:96px!important;}
#drawer.r1158-active .r1156-group-stock td :is(button,.btn) {min-height:26px!important;padding:3px 6px!important;font-size:10px!important;margin:1px 2px!important;}
/* Logical single-scroll order. No tabs, no duplicate photo in documents. */
#drawer.r1158-active .r1156-group-overview {order:1;}
#drawer.r1158-active .r1156-group-specifications {order:2;}
#drawer.r1158-active .r1156-group-bearings {order:3;}
#drawer.r1158-active .r1156-group-inventory,
#drawer.r1158-active .r1156-group-stock,
#drawer.r1158-active .r1156-group-equipment {order:4;}
#drawer.r1158-active .r1156-group-history {order:5;}
#drawer.r1158-active .r1156-group-transactions {order:6;}
#drawer.r1158-active .r1156-group-documents,
#drawer.r1158-active .r1156-group-attachments {order:9;}
#drawer.r1158-active .r1156-group :is(.r5-image-grid,.r79-catalog-grid).emd-r93-source-hidden {display:none!important;}
#drawer.r1158-active :is(button,.btn,a):focus-visible {outline:2px solid var(--r1155-accent)!important;outline-offset:2px!important;}
/* Other non-Daily-Work read-only and editing drawers receive only the narrower width. */
body.r107-ui #drawer.r1156-simple-active:not(.r1154-workdrawer):not(.r1152-workdrawer) .drawerpanel,
body.r107-ui #drawer.r1155-form-active:not(.r1154-workdrawer):not(.r1152-workdrawer) .drawerpanel {
  width:min(790px,calc(100vw - 34px))!important;
}
@media(max-width:900px){
 body.r107-ui #drawer.r1158-active .drawerpanel {width:min(790px,96vw)!important;}
 body.r107-ui #drawer.r1158-active .r1157-media-details,
 body.r107-ui #drawer.r1158-active .r1156-group-overview .r79-bearing-top {grid-template-columns:minmax(180px,.84fr) minmax(0,1.16fr)!important;}
 #drawer.r1158-active .r1157-media-details .r5-detail-grid {grid-template-columns:1fr!important;}
}
@media(max-width:650px){
 body.r107-ui #drawer.r1158-active .drawerpanel,
 body.r107-ui #drawer.r1156-simple-active:not(.r1154-workdrawer) .drawerpanel,
 body.r107-ui #drawer.r1155-form-active:not(.r1154-workdrawer) .drawerpanel {width:100vw!important;max-width:100vw!important;}
 body.r107-ui #drawer.r1158-active .r1157-media-details,
 body.r107-ui #drawer.r1158-active .r1156-group-overview .r79-bearing-top {grid-template-columns:1fr!important;}
 #drawer.r1158-active .r1157-real-kpis,#drawer.r1158-active .r1156-metrics {grid-template-columns:repeat(2,minmax(0,1fr))!important;}
 #drawer.r1158-active .r1156-group .r1156-stock-fields .r79-tech-grid {grid-template-columns:repeat(2,minmax(0,1fr))!important;}
 #drawer.r1158-active .r1156-group-history .r711-maint-grid {grid-template-columns:1fr!important;}
}
@media(prefers-reduced-motion:reduce){#drawer.r1158-active *{scroll-behavior:auto!important;animation:none!important;}}
/* Override older display:grid!important selectors when a value was never recorded. */
body.r107-ui #drawer.r1158-active .r1157-media-details .r5-detail.r1158-blank-field,
body.r107-ui #drawer.r1158-active .r1156-group .r1157-media-details .r5-detail.r1158-blank-field {display:none!important;}
