/* Transport History table; the dashboard keeps its existing shipment view. */
body.shipments-view.history-table-ready #rows{display:none!important}
/* Keep the tall filter panel from covering expanded load details while scrolling. */
body.shipments-view.history-table-ready .shipment-toolbar{position:relative;top:auto;z-index:auto}
#history-load-table{margin:0;background:#fff;overflow:hidden;container-type:inline-size}
#history-load-table[hidden]{display:none!important}
#history-load-table .ht-table{width:100%;table-layout:fixed;border-collapse:collapse;white-space:normal}
#history-load-table th{padding:15px 16px;background:#f8fafc;color:#65778d;font-size:11px;letter-spacing:.07em;font-weight:650;text-transform:uppercase;text-align:left;border-bottom:1px solid #dce5ef}
#history-load-table th:nth-child(1){width:22%}#history-load-table th:nth-child(2){width:12%}#history-load-table th:nth-child(3){width:16%}#history-load-table th:nth-child(4),#history-load-table th:nth-child(5){width:18%}#history-load-table th:nth-child(6){width:14%;text-align:right}
#history-load-table td{padding:18px 16px;min-width:0;border:0;border-bottom:1px solid #e5eaf1;vertical-align:middle;font-size:13px;white-space:normal;overflow-wrap:anywhere;color:#2b435e}
#history-load-table td strong{display:block;font-size:13px;line-height:1.5;font-weight:600}
#history-load-table td small{display:block;color:#718196;font-size:11px;line-height:1.6;margin-top:5px}
#history-load-table .ht-row-city{display:block;font-size:12px;line-height:1.5;margin-top:1px;color:#62778e}
#history-load-table .ht-load-row{cursor:pointer;transition:background-color .12s ease}
#history-load-table .ht-load-row:hover{background:#f7faff}
#history-load-table .ht-load-row.is-expanded{background:#edf4ff}
#history-load-table .ht-row-toggle{display:flex;align-items:center;gap:6px;border:0;background:none;color:#004aad;padding:5px 0;font:inherit;cursor:pointer;text-align:left;min-height:32px}
#history-load-table .ht-row-toggle svg{width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;transition:transform .15s ease}
#history-load-table .is-expanded .ht-row-toggle svg{transform:rotate(90deg)}
#history-load-table .ht-row-total{text-align:right}
#history-load-table .ht-cost-badge{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;width:112px;min-height:68px;max-width:100%;box-sizing:border-box;padding:6px 10px;border:1px solid #dce2e9;border-radius:9px;background:#f2f4f7;color:#526176;text-align:center}
#history-load-table .ht-cost-badge[data-billing=dealer]{background:#eaf2ff;border-color:#cbdcf5;color:#194f91}
#history-load-table .ht-cost-badge[data-billing=client]{background:#eaf6ef;border-color:#c9e4d4;color:#236347}
#history-load-table .ht-cost-badge[data-billing=split]{background:#f1edfb;border-color:#ddd3f1;color:#67449a}
#history-load-table .ht-cost-badge>strong{font-size:15px;color:inherit;font-variant-numeric:tabular-nums;line-height:1.35;white-space:nowrap}
#history-load-table .ht-billing-label{display:flex;align-items:center;justify-content:center;min-height:28px;font-size:10px;font-weight:600;line-height:1.4}
#history-load-table .ht-status{display:inline-flex;align-items:center;line-height:1.35;border-radius:20px;padding:5px 9px;font-size:11px;font-weight:650;background:#eef3fa;color:#466183}
#history-load-table .ht-status[data-status="in transit"]{background:#e6f0ff;color:#0050ad}
#history-load-table .ht-status[data-status=delivered]{background:#e6f5ec;color:#1c7857}
#history-load-table .ht-status[data-status=cancelled]{background:#f1f2f5;color:#6d7687}
#history-load-table .ht-late{color:#9a5b13;font-weight:600}
#history-load-table a{color:#004aad;text-decoration:none;font-weight:600}
#history-load-table a:hover{text-decoration:underline}
#history-load-table .ht-tracking{display:block;font-size:11px;margin-top:7px;line-height:1.6}
#history-load-table .ht-detail-row>td{padding:0;border-bottom:1px solid #d0def0}
#history-load-table .ht-summary{padding:12px;background:#f3f6fb;border-left:3px solid #004aad}
#history-load-table .ht-summary-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:10px}
#history-load-table .ht-summary-heading h2{font-size:18px;margin:0 0 2px;color:#244361}
#history-load-table .ht-summary-heading p{font-size:12px;color:#6a7d92;margin:0}
.ht-kicker{font-size:10px;letter-spacing:.09em;text-transform:uppercase;font-weight:650;color:#6a7d92}
#history-load-table .ht-summary-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end;max-width:55%}
#history-load-table .ht-summary-actions button,#history-load-table .ht-summary-actions a{font-family:inherit;font-size:12px;line-height:1.5;font-weight:600;padding:8px 12px;min-height:38px;border:1px solid #ccd9e9;border-radius:7px;background:#fff;color:#004aad;text-decoration:none;cursor:pointer}
/* Shared rows align both edges without fixed heights or extra padding. */
#history-load-table .ht-summary-grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(300px,1fr);grid-template-areas:"route cost" "vehicles activity" "transporter transporter" "documents documents";gap:10px;align-items:stretch}
#history-load-table .ht-route{grid-area:route}
#history-load-table .ht-transporter{grid-area:transporter}
#history-load-table .ht-vehicles{grid-area:vehicles}
#history-load-table .ht-cost{grid-area:cost}
#history-load-table .ht-documents{grid-area:documents}
#history-load-table .ht-activity{grid-area:activity}
#history-load-table .ht-section{padding:12px;background:#fff;border:1px solid #dce5ee;border-radius:9px;min-width:0}
#history-load-table h3{font-size:15px;line-height:1.5;color:#294765;margin:0 0 9px;letter-spacing:-.01em}
#history-load-table h3>span{margin-left:8px;border-radius:5px;background:#eff3f9;padding:3px 7px;color:#607992;font-size:11px}
#history-load-table h4{font-size:14px;line-height:1.45;font-weight:600;color:#294765;margin:4px 0}
#history-load-table .ht-section p{margin:5px 0;font-size:13px;line-height:1.5;white-space:pre-line}
#history-load-table .ht-muted{color:#7a8899;font-size:12px;line-height:1.6;font-weight:400}
#history-load-table .ht-leg+.ht-leg{border-top:1px solid #e3eaf2;margin-top:12px;padding-top:12px}
#history-load-table .ht-leg-heading{display:flex;align-items:center;gap:10px;justify-content:space-between;background:#f4f7fc;border-radius:6px;padding:6px 8px;margin-bottom:9px}
#history-load-table .ht-leg-heading>strong{font-size:12px;color:#004aad}
#history-load-table .ht-leg-heading>span{font-size:11px;color:#697f97}
#history-load-table .ht-stops{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(6,auto);column-gap:16px;row-gap:0}
#history-load-table .ht-stop{min-width:0;display:grid;grid-template-rows:subgrid;grid-row:span 6;row-gap:0}
#history-load-table .ht-stop .ht-schedule{margin:8px 0;padding:7px 0;border-block:1px solid #edf1f6;color:#3d5874}
#history-load-table .ht-stop .ht-schedule strong{font-size:12px;color:#6a7d92;margin-bottom:3px}
#history-load-table .ht-stop .ht-schedule span{display:block}
#history-load-table .ht-instruction{padding:9px 11px;background:#f7f9fc;border-radius:6px;color:#657b93}
#history-load-table dl{margin:0}
#history-load-table dl>div{display:flex;justify-content:space-between;gap:16px;padding:7px 0;border-bottom:1px solid #eef2f7;line-height:1.5}
#history-load-table dl>div:last-child{border-bottom:0}
#history-load-table dt{font-size:13px;color:#6a7d92;font-weight:400}
#history-load-table dd{font-size:14px;color:#294765;text-align:right;margin:0;min-width:0}
#history-load-table .ht-cost dl>div:last-child:has(strong){border-top:1px solid #dce5ef;margin-top:4px;padding-top:10px;align-items:center}
#history-load-table .ht-cost dl>div:only-child{border-top:0!important;margin-top:0!important;padding-top:0!important}
#history-load-table .ht-cost dd>strong{font-size:21px;color:#004aad}
#history-load-table .ht-cost .ht-reference{margin-top:9px}
#history-load-table .ht-billing-split{background:#f4f7fb;padding:12px;border-radius:8px;margin-top:15px}
#history-load-table .ht-allocations{margin-top:15px;font-size:12px}
#history-load-table .ht-allocations summary{cursor:pointer;color:#004aad;font-weight:600}
#history-load-table .ht-transporter-body{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr) minmax(0,.8fr);gap:20px;align-items:center}
#history-load-table .ht-driver{display:flex;align-items:center;gap:12px}
#history-load-table .ht-driver img,#history-load-table .ht-driver-placeholder{width:96px;height:112px;object-fit:cover;flex:none;border-radius:10px;background:#eaf1fa}
#history-load-table .ht-driver-placeholder{display:grid;place-items:center;color:#507396;font-size:21px;font-weight:600}
#history-load-table .ht-driver p{font-size:12px;color:#688099}
#history-load-table .ht-driver-identity{min-width:0;flex:1}
#history-load-table .ht-driver-identity>strong{font-size:15px;margin:2px 0 6px}
#history-load-table .ht-driver-contact{display:grid;grid-template-columns:minmax(0,1fr);gap:4px;padding-left:20px;border-left:1px solid #e4eaf2}
#history-load-table .ht-driver-contact>div{padding:0;border:0;display:block}
#history-load-table .ht-driver-contact dd{text-align:left}
#history-load-table .ht-driver-contact dt{font-size:12px}
#history-load-table .ht-carrier-numbers{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;border-left:1px solid #e4eaf2;padding-left:20px}
#history-load-table .ht-carrier-numbers>div{display:block;padding:0;border:0}
#history-load-table .ht-carrier-numbers dt{font-size:12px}
#history-load-table .ht-carrier-numbers dd{text-align:left;font-weight:600;margin-top:2px}
#history-load-table .ht-assignment-status{font-size:12px;color:#657c96;white-space:normal;text-align:right}
#history-load-table .ht-assignment-details{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:8px 16px;margin-top:10px;padding-top:10px;border-top:1px solid #e4eaf2}
#history-load-table .ht-assignment-details>div{display:block;padding:0;border:0}
#history-load-table .ht-assignment-details dd{text-align:left}
#history-load-table .ht-unassigned{padding:12px 0;color:#6d839a}
#history-load-table .ht-unassigned>span{font-size:28px;display:block;margin-bottom:12px}
#history-load-table .ht-unassigned>strong{font-size:13px}
#history-load-table .ht-vehicle{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:12px;padding:9px 0;border-top:1px solid #e3eaf1}
#history-load-table .ht-vehicle:first-child{border-top:0;padding-top:0}
#history-load-table .ht-vehicle:last-child{padding-bottom:0}
#history-load-table .ht-vehicle dl{display:grid;grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr);gap:10px;align-items:start}
#history-load-table .ht-vehicle dl>div{display:block;padding:0;border:0}
#history-load-table .ht-vehicle dd{text-align:left}
#history-load-table code{display:block;font:12px/1.5 ui-monospace,SFMono-Regular,monospace;color:#5b7490;margin-top:4px;overflow-wrap:anywhere}
#history-load-table .ht-leg-tag{display:inline-block;font-size:10px;color:#547395;background:#eef3f9;border-radius:4px;padding:2px 6px;margin-top:6px}
#history-load-table .ht-match{background:#eff6ff;border-radius:6px;padding:12px}
#history-load-table .ht-section-heading{display:flex;gap:16px;align-items:baseline;justify-content:space-between}
#history-load-table .ht-section-heading>a{font-size:11px}
#history-load-table .ht-document-group+ .ht-document-group{margin-top:10px;padding-top:9px;border-top:1px solid #e2eaf2}
#history-load-table .ht-document-group h4{display:flex;align-items:center;gap:8px;font-size:12px}
#history-load-table .ht-document-group h4 span{font-size:10px;color:#73869b;background:#f0f4f9;border-radius:4px;padding:1px 5px}
#history-load-table .ht-document-group:has(>p.ht-muted){display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-wrap:wrap}
#history-load-table .ht-document-group:has(>p.ht-muted) h4,#history-load-table .ht-document-group:has(>p.ht-muted) p{margin:2px 0}
#history-load-table .ht-document{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:6px 0}
#history-load-table .ht-document strong{font-size:12px}
#history-load-table .ht-document small{font-size:10px}
#history-load-table .ht-document-actions{display:flex;gap:10px;flex-shrink:0}
#history-load-table .ht-document-actions button{padding:7px 0;min-height:32px;border:0;background:none;color:#004aad;font-size:11px;font-weight:600;cursor:pointer}
#history-load-table .ht-load-note{background:#f7f9fc;border-radius:7px;padding:10px;margin-bottom:10px}
#history-load-table .ht-activity ol{margin:0;padding:0;list-style:none}
#history-load-table .ht-activity li{position:relative;margin-left:4px;padding:0 0 12px 17px;border-left:1px solid #dce5ef}
#history-load-table .ht-activity li:last-child{padding-bottom:0}
#history-load-table .ht-activity li:before{content:'';position:absolute;left:-4px;top:6px;width:7px;height:7px;background:#82a3c8;border:2px solid #fff;box-shadow:0 0 0 1px #dce5ef;border-radius:50%}
#history-load-table .ht-activity li>strong{font-size:12px;text-transform:capitalize}
#history-load-table .ht-activity li>span{display:block;font-size:11px;color:#71869c;margin-top:3px}
#history-load-table .ht-action-message{font-size:13px;margin:0;padding:16px 24px;color:#004aad}
#history-load-table .ht-action-message:empty{display:none}
#history-load-table :focus-visible,.ht-document-viewer :focus-visible{outline:2px solid #004aad;outline-offset:3px}
.ht-document-viewer{width:calc(100% - 32px);max-width:900px;height:calc(100dvh - 48px);max-height:820px;padding:0;border:1px solid #dce5ef;border-radius:14px;color:#294765;overflow:hidden}
.ht-document-viewer[open]{display:flex;flex-direction:column}
.ht-document-viewer::backdrop{background:#13274088;backdrop-filter:blur(3px)}
.ht-document-viewer>header,.ht-document-viewer>footer{flex:none;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 22px;border-bottom:1px solid #e3eaf2}
.ht-document-viewer>header h2{font-size:18px;line-height:1.4;margin:5px 0;overflow-wrap:anywhere}
.ht-document-viewer button{min-height:40px;padding:8px 15px;border:1px solid #cbd9e8;border-radius:7px;background:#fff;color:#004aad;font:inherit;cursor:pointer}
.ht-document-viewer>footer{justify-content:flex-end;border-top:1px solid #e3eaf2;border-bottom:0}
.ht-document-body{flex:1;min-height:0;overflow:auto;padding:16px 22px;display:flex;flex-direction:column}
.ht-document-body>p{font-size:12px;color:#657c95}
.ht-document-body iframe{width:100%;border:1px solid #e3eaf2;background:#fff;flex:1;min-height:250px}
.ht-document-body>img{max-width:100%;object-fit:contain}
@container(max-width:900px){
 #history-load-table .ht-load-row>.ht-row-total{padding-inline:8px}
 #history-load-table .ht-cost-badge{padding-inline:6px}
 #history-load-table th,#history-load-table .ht-load-row>td{padding:15px 12px}
 #history-load-table .ht-summary{padding:12px}
 #history-load-table .ht-summary-grid{grid-template-columns:minmax(0,1.2fr) minmax(260px,1fr);gap:10px}
 #history-load-table .ht-section{padding:12px}
 #history-load-table .ht-stops{column-gap:14px}
 #history-load-table .ht-vehicle{grid-template-columns:1fr;gap:10px}
 #history-load-table .ht-transporter-body{grid-template-columns:minmax(0,1.2fr) minmax(0,1fr) minmax(0,.85fr);gap:12px}
 #history-load-table .ht-driver-contact,#history-load-table .ht-carrier-numbers{padding-left:12px}
 #history-load-table .ht-carrier-numbers{grid-template-columns:minmax(0,1fr);gap:4px}
 #history-load-table .ht-document{align-items:flex-start;flex-direction:column;gap:4px}
}
@container(max-width:760px){
 #history-load-table .ht-table,#history-load-table tbody{display:block}
 #history-load-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 #history-load-table .ht-load-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding:18px 16px;border-bottom:1px solid #dce5ef}
 #history-load-table .ht-load-row>td{display:block;padding:0;border:0;min-width:0}
 #history-load-table .ht-load-row>td:nth-child(3){grid-column:1/-1;grid-row:2}
 #history-load-table .ht-load-row>td:nth-child(4){grid-row:3}#history-load-table .ht-load-row>td:nth-child(5){grid-row:3}
 #history-load-table .ht-load-row>td:nth-child(6){grid-column:1/-1;text-align:left;display:flex;align-items:center;justify-content:space-between;border-top:1px solid #e3eaf2;padding-top:12px}
 #history-load-table .ht-load-row>td:nth-child(2){text-align:right}
 #history-load-table .ht-load-row>td:nth-child(n+3):before{content:attr(data-label);display:block;font-size:10px;letter-spacing:.04em;color:#718499;margin-bottom:5px;text-transform:uppercase}
 #history-load-table .ht-row-toggle{min-height:44px;margin-top:-6px}
 #history-load-table .ht-tracking{min-height:30px;display:inline-flex;align-items:center;font-size:12px}
 #history-load-table .ht-load-row td strong{font-size:14px}
 #history-load-table .ht-detail-row,#history-load-table .ht-detail-row>td{display:block}
 #history-load-table .ht-summary{padding:12px 10px;border-left-width:2px}
 #history-load-table .ht-summary-heading{display:block;margin-bottom:12px}
 #history-load-table .ht-summary-actions{max-width:none;justify-content:flex-start;margin-top:12px}
 #history-load-table .ht-summary-actions button,#history-load-table .ht-summary-actions a{min-height:42px}
 #history-load-table .ht-summary-grid{grid-template-columns:minmax(0,1fr);grid-template-areas:"route" "cost" "vehicles" "activity" "transporter" "documents";gap:10px}
 #history-load-table .ht-transporter-body{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 #history-load-table .ht-driver{grid-column:1/-1}
 #history-load-table .ht-driver-contact{padding:0;border:0;gap:6px}
 #history-load-table .ht-carrier-numbers{gap:6px}
 #history-load-table .ht-transporter .ht-section-heading{flex-direction:row;align-items:center;margin-bottom:10px}
 #history-load-table .ht-transporter .ht-section-heading h3{margin:0}
 #history-load-table .ht-stops{grid-template-columns:minmax(0,1fr);grid-template-rows:none;gap:12px}
 #history-load-table .ht-stop{display:block;grid-row:auto}
 #history-load-table .ht-stop+.ht-stop{border-top:1px solid #e3eaf2;padding-top:16px}
 #history-load-table .ht-leg-heading{align-items:flex-start;flex-direction:column;gap:4px}
 #history-load-table .ht-document-actions button{font-size:12px;min-height:44px}
 #history-load-table .ht-section-heading{align-items:flex-start;flex-direction:column;gap:0;margin-bottom:12px}
 #history-load-table .ht-section-heading h3{margin-bottom:8px}
}
@media(prefers-reduced-motion:reduce){#history-load-table .ht-load-row,#history-load-table .ht-row-toggle svg{transition:none}}

.ht-original-document{display:block;margin:14px 0 0;color:#004aad;font-size:13px;font-weight:600}.ht-pdf-pages{width:100%;font-size:12px;color:#637b96}.ht-pdf-pages canvas{display:block;max-width:100%;height:auto;border:1px solid #dce5ef;margin-bottom:18px;background:#fff}
