/* Active manifest work stays in the list; shared by desktop and phone layouts. */
.active-shipment-scroll { overflow-x:auto; max-width:100%; }
.active-shipment-table { width:100%; border-collapse:collapse; table-layout:auto; font-size:.8rem; color:var(--white); }
.active-shipment-table th { text-align:left; padding:9px 10px; color:var(--steel); font-size:.7rem; letter-spacing:.04em; border-bottom:1px solid var(--border); white-space:nowrap; }
.active-shipment-table .active-shipment-row>td { padding:6px 8px; vertical-align:middle; border-bottom:1px solid var(--border); }
.active-shipment-table .mawb-detail-cell { cursor:pointer; min-width:185px; }
.active-shipment-table .srow-id { white-space:nowrap; overflow-wrap:normal; word-break:normal; }
/* Keep selection beside the identifier, not above it. These scoped rules also
   outrank the legacy selectable-card rules loaded later in index.html. */
.active-shipment-table .manifest-shipment-identity { display:flex; align-items:center; gap:6px; flex-wrap:nowrap; }
.active-shipment-table .active-shipment-row .manifest-shipment-identity .manifest-shipment-heading { display:flex; flex:none; flex-wrap:nowrap; align-items:center; gap:6px; min-width:max-content; }
.active-shipment-table .active-shipment-row .srow-id { white-space:nowrap; overflow-wrap:normal; word-break:normal; flex:none; max-width:none; }
.active-shipment-table .manifest-shipment-identity>.bme-inline-shipment-check { margin:0; min-width:28px; min-height:32px; }
.active-shipment-table .manifest-shipment-identity input[type="checkbox"] { flex-shrink:0; margin:0; }
.active-shipment-table .srow-info { margin-top:2px; }
.active-shipment-table .srow-info:empty { display:none; }
.active-shipment-table .inline-actions { display:flex; align-items:center; gap:7px; white-space:nowrap; }
.active-shipment-table .shipment-details { background:transparent; color:var(--white); border-color:var(--steel); }
.active-shipment-table .shipment-details:hover { color:var(--gold); border-color:var(--gold); }
.active-shipment-table :focus-visible { outline:2px solid var(--gold); outline-offset:2px; }
.active-manifest-parties { display:flex; flex-wrap:wrap; gap:4px 12px; font-size:.72rem; color:var(--steel); margin-top:5px; }
.active-manifest-parties b { color:var(--white); font-weight:500; }
.manifest-party-column { min-width:0; font-size:.8rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
/* BEGIN compact column heading polish
   These ID-scoped selectors outrank the later index.html heading rules.
   Only column labels change: retain row type, sort gold, tracks and padding. */
#b-mlist .bman-table>thead>tr>th {
  font-size:.75rem;
  font-weight:900;
  letter-spacing:0;
  color:#b4c5d6;
}
#c-mlist .cman-cols-lbl,
#drv-mlist .dman-cols-lbl,
#sp-loads-list .sp-active-totals>table>thead>tr>th {
  font-size:.82rem;
  font-weight:900;
  letter-spacing:.025em;
  color:#b4c5d6;
}
/* Party and airline labels otherwise use their data-cell sizes rather than
   the column-heading typography (including dynamically added columns). */
#c-mlist .cman-cols-lbl>.manifest-party-column,
#drv-mlist .dman-cols-lbl>.manifest-party-column,
#drv-mlist .dman-cols-lbl>.dman-air {
  font-size:inherit;
}
:is(#b-mlist,#c-mlist,#drv-mlist) .active-shipment-table>thead>tr>th {
  font-size:.77rem;
  font-weight:800;
  letter-spacing:-.02em;
  color:#b4c5d6;
}
/* The dispatcher's desktop table rule also reaches nested MAWB headers;
   start from its actual .66rem / 800 baseline, not the shared .7rem rule. */
@media(min-width:960px) {
  #b-mlist .active-shipment-table>thead>tr>th {
    font-size:.75rem;
    font-weight:900;
  }
}
/* END compact column heading polish */
@media(min-width:781px) {
  .active-manifest-parties { display:none; }
  #c-mlist :is(.cman-row,.cman-cols-lbl)>.cman-dispatcher { order:16; display:block; }
  #c-mlist :is(.cman-row,.cman-cols-lbl)>.cman-shipper { display:block; }
  #drv-mlist :is(.dman-row,.dman-cols-lbl)>.dman-dispatcher { order:6; display:block; }
  #drv-mlist :is(.dman-row,.dman-cols-lbl)>.dman-carrier { order:7; display:block; }
}
/* Highlight the actual expanded header, never its shipment body. Keep party
   colors and status badges independent of the manifest identifier. */
:is([data-inline-manifest],tr[data-search-manifest]) :is(.mid,.bman-mid) { color:var(--gold); }
:is(#b-mlist,#c-mlist,#drv-mlist) :is([data-inline-manifest],tr[data-search-manifest])[aria-expanded="true"] {
  background:rgba(240,165,0,.16);
  color:var(--white);
}
/* Desktop table cells (including their hover rule) must not cover the tint. */
:is(#b-mlist,#c-mlist,#drv-mlist) tr[data-search-manifest][aria-expanded="true"]>td {
  background:transparent;
}
/* Native scrollbar arrow buttons only; retain tracks, thumbs and scrolling.
   Engines without this pseudo-element keep their native scrollbar controls. */
*::-webkit-scrollbar-button { display:none; width:0; height:0; }
.mbody.open .active-shipment-table .srow-id { color:#4ade80; }
tr[data-expanded-manifest]>td { padding:0; background:var(--navy); }
tr[data-expanded-manifest] .mbody { display:block; }
.mbody.open:has(>.active-shipment-scroll) { padding:4px 13px 6px; }
.active-shipment-table .active-shipment-row .inline-actions { gap:6px; }
.active-shipment-table .active-shipment-row .inline-actions>button { min-height:32px; }
.active-note-icon { display:inline-flex; align-items:center; justify-content:center; color:#facc15; vertical-align:middle; font-size:inherit; gap:4px; }
.active-note-icon svg { width:1em; height:1em; flex:none; }
button.active-note-icon { border:0; background:transparent; padding:4px; min-width:28px; cursor:pointer; }
.active-mobile-only { display:none; }
.scoped-notes-dialog { width:min(640px,calc(100vw - 24px)); max-height:88dvh; overflow:auto; background:var(--navy); color:var(--white); border:1px solid var(--border); border-radius:10px; padding:20px; }
.scoped-notes-dialog::backdrop { background:rgba(8,18,30,.78); }
.scoped-notes-dialog header,.scoped-notes-dialog footer { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.scoped-notes-dialog h2 { font:700 1.3rem 'Barlow Condensed',sans-serif; color:var(--gold); margin:0; }
.scoped-notes-thread { margin:16px 0; }
.scoped-notes-entry { border-left:3px solid #facc15; padding:8px 12px; margin-bottom:10px; background:rgba(255,255,255,.035); }
.scoped-notes-entry p { white-space:pre-wrap; overflow-wrap:anywhere; margin:0 0 5px; }
.scoped-notes-entry small,.scoped-notes-empty { color:var(--steel); }
.scoped-notes-dialog textarea { width:100%; min-height:96px; margin:8px 0 12px; }
.scoped-notes-error { color:#fca5a5; margin:8px 0; }
@media(min-width:781px) {
  /* Measured from the corresponding manifest number, not the card/table edge.
     Keep the right edge and native horizontal scrolling unchanged. */
  :is(#b-mlist,#c-mlist,#drv-mlist) .mbody.open:has(>.active-shipment-scroll) { padding:4px 12px 6px var(--mawb-parent-inset,48px); }
}
@media(max-width:780px) {
  .active-shipment-actions .inline-actions .active-note-icon { order:4; font-size:.9rem!important; min-width:32px; }
  .active-shipment-actions .inline-actions .search-paperwork { order:3; }
  .active-shipment-actions .inline-actions .cmenu-wrap { order:5; }
  #b-mlist .bman-mobile-summary .manifest-party-carrier,
  #c-mlist .cman-mobile-summary .manifest-party-driver,
  #c-mlist .active-manifest-parties-c .manifest-party-driver b,
  #drv-mlist .active-manifest-parties-d .manifest-party-dispatcher b { color:#4ade80; }
  #b-mlist .bman-mobile-summary .manifest-party-driver { color:var(--gold); }
  .manifest-party-column { display:none; }
  .active-shipment-table th { padding:9px 8px; }
  .active-shipment-scroll { -webkit-overflow-scrolling:touch; }
  .active-mobile-only { display:inline; }
  .active-desktop-only { display:none; }
  .active-shipment-scroll { overflow:visible; }
  .active-shipment-table,
  .active-shipment-table tbody { display:block; width:100%; }
  .active-shipment-table thead { display:block; }
  .active-shipment-table thead tr { display:grid; grid-template-columns:minmax(0,1fr) 38px 52px; }
  .active-shipment-table th { padding:5px 2px; text-transform:none; }
  .active-shipment-table th:nth-child(n+4) { display:none; }
  .active-shipment-table .active-shipment-row { display:grid; grid-template-columns:minmax(0,1fr) 38px 52px; padding:3px 0 5px; border-bottom:1px solid var(--border); }
  .active-shipment-table .active-shipment-row>td { padding:3px 2px; border:0; min-width:0; }
  .active-shipment-table .active-shipment-row>td:nth-child(n+4) { display:none; }
  .active-shipment-table .active-shipment-row>td.active-shipment-actions { display:block; grid-column:1/-1; }
  .active-shipment-table .mawb-detail-cell { min-width:0; }
  .active-shipment-table .active-shipment-row .manifest-shipment-identity .manifest-shipment-heading { min-width:0; flex:1; gap:4px; flex-wrap:wrap; }
  .active-shipment-table .active-shipment-row .srow-id { font-size:.78rem; max-width:100%; }
  .active-shipment-table .manifest-shipment-heading .badge { font-size:.6rem; letter-spacing:.02em; padding:3px 4px; gap:3px; }
  .active-shipment-table .active-shipment-row .srow-info { display:none; }
  .active-shipment-table .active-shipment-row .inline-actions { flex-wrap:wrap; white-space:normal; }
  .active-shipment-table .active-shipment-row .inline-actions .btn { padding:4px 8px; font-size:.72rem; }
  .active-shipment-table .active-shipment-row .inline-actions .cmenu-btn { min-width:32px; min-height:32px; }
  .active-shipment-table .active-shipment-row .cmenu-drop { right:0; left:auto; }
}
