/* Secondary workspaces: keep product identity and each quantity readable.
   Details may collapse on phones; names and labelled summaries may not clip. */
.purchase-card-title { align-items:flex-start; }
.purchase-card-title>div,.purchase-card-title>strong { min-width:0; flex:1; }
.purchase-card-title strong { white-space:normal; overflow-wrap:anywhere; line-height:1.45; }
.purchase-card>dl { max-width:560px; }
.purchase-card dl:not(.purchase-quantity-grid)>div { display:grid; grid-template-columns:minmax(100px,1fr) minmax(0,1.3fr); align-items:start; gap:12px; }
.purchase-card dl:not(.purchase-quantity-grid) dt,.purchase-card dl:not(.purchase-quantity-grid) dd { line-height:1.5; }
.purchase-card .purchase-quantity-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; margin:0; }
.purchase-card .purchase-quantity-grid>div { display:block; min-width:0; margin:0; padding:8px; background:#f6f8f3; border-radius:6px; }
.purchase-quantity-grid dt { font-size:13px; line-height:1.45; }
.purchase-card .purchase-quantity-grid dd { text-align:left; margin:5px 0 0; font-size:16px; line-height:1.4; }
.purchase-quantity-grid dd strong { font-size:17px; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.purchase-quantity-grid dd span { white-space:nowrap; color:var(--muted); }
.purchase-actions .button { min-height:44px; white-space:normal; }
.purchase-delivery-line .purchase-card-title { margin-top:8px; }
/* One order per row avoids empty grid columns beside long supplier orders. */
#purchase-list.purchase-orders { grid-template-columns:minmax(0,1fr); gap:10px; }
#purchase-list .purchase-order-card { padding:0; overflow:hidden; }
.purchase-order-summary { display:grid; grid-template-columns:minmax(0,1fr) minmax(270px,.9fr) 110px; align-items:center; gap:16px; padding:16px 20px; cursor:pointer; list-style:none; }
.purchase-order-summary::-webkit-details-marker { display:none; }
.purchase-order-summary:focus-visible { outline:2px solid var(--forest); outline-offset:-3px; }
.purchase-order-summary:hover { background:#fafbf8; }
.purchase-order-heading,.purchase-order-overview { min-width:0; }
.purchase-order-summary .purchase-card-title { gap:10px; }
.purchase-order-summary h2 { font-size:17px; margin:0 0 4px; line-height:1.4; }
.purchase-order-summary .item-thumbnail,.purchase-order-summary .item-initial { width:36px; height:36px; min-width:36px; }
.purchase-supplier-name { font-size:14px; line-height:1.4; margin:0 0 5px; color:var(--muted); overflow-wrap:anywhere; }
.purchase-order-dates { display:flex; flex-wrap:wrap; gap:3px 16px; margin-top:8px; font-size:13px; line-height:1.5; color:var(--muted); overflow-wrap:anywhere; }
.purchase-order-preview,.purchase-order-progress { font-size:14px; line-height:1.5; margin:0; overflow-wrap:anywhere; }
.purchase-order-progress { margin-top:6px; color:var(--muted); }
.purchase-expand-label { display:flex; align-items:center; justify-content:flex-end; gap:8px; min-height:44px; font-size:14px; color:var(--forest); white-space:nowrap; }
.purchase-chevron { font-size:22px; }
.purchase-hide-label,.purchase-order-details[open]>.purchase-order-summary .purchase-show-label { display:none; }
.purchase-order-details[open]>.purchase-order-summary .purchase-hide-label { display:inline; }
.purchase-order-details[open]>.purchase-order-summary .purchase-chevron { transform:rotate(180deg); }
.purchase-order-body { padding:0 20px 16px; border-top:1px solid var(--line); }
.purchase-order-body .purchase-order-tools { gap:10px 16px; margin:12px 0; }
.purchase-recorded-by { margin-left:auto; font-size:13px; color:var(--muted); overflow-wrap:anywhere; }
.purchase-order-note { margin:12px 0; line-height:1.5; overflow-wrap:anywhere; }
.purchase-line-overview { display:grid; grid-template-columns:minmax(0,1fr) minmax(270px,.9fr); align-items:center; gap:16px; }
.purchase-order-card .purchase-delivery-line .purchase-card-title { margin-top:0; }
.purchase-order-card .purchase-delivery-line+.purchase-delivery-line { margin-top:12px; padding-top:12px; }
@media(max-width:1100px){
 .purchase-order-summary { grid-template-columns:minmax(0,1fr) 110px; gap:10px; }
 .purchase-order-overview { grid-column:1/-1; grid-row:2; }
 .purchase-expand-label { grid-column:2; grid-row:1; align-self:start; }
}
@media(max-width:700px){
 .purchase-order-summary { padding:12px; grid-template-columns:minmax(0,1fr); gap:8px; }
 .purchase-order-overview { grid-row:auto; }
 .purchase-expand-label { grid-column:1; grid-row:auto; justify-content:flex-start; min-height:28px; }
 .purchase-order-body { padding:0 12px 12px; }
 .purchase-line-overview { grid-template-columns:minmax(0,1fr); gap:8px; }
 .purchase-recorded-by { width:100%; margin-left:0; }
 .purchase-order-card .purchase-quantity-grid { gap:4px; }
 .purchase-order-card .purchase-quantity-grid>div { padding:7px 5px; }
 .purchase-order-card .purchase-quantity-grid dt { font-size:12px; min-height:35px; }
 .purchase-order-card .purchase-quantity-grid dd { font-size:12px; margin-top:3px; }
 .purchase-order-card .purchase-quantity-grid dd strong { display:block; font-size:16px; line-height:1.4; }
}
.dispatch-row>summary { height:auto; min-height:72px; align-items:flex-start; padding:14px 0; }
.dispatch-row-name strong,.dispatch-row-name small { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; }
.dispatch-row-name strong { line-height:1.45; }
.dispatch-row-name small { margin-top:4px; line-height:1.5; }
.dispatch-row-qty { font-variant-numeric:tabular-nums; white-space:nowrap; }
.dispatch-row-qty small { white-space:normal; max-width:130px; overflow:visible; text-overflow:clip; line-height:1.4; margin-top:4px; }
#sourcing-table td>.button { display:block; width:100%; margin-bottom:8px; }
#sourcing-table td>.button:last-child { margin-bottom:0; }
#sourcing-table .vendor-contact strong { line-height:1.45; }
@media(max-width:700px){
 #purchase-list .purchase-card.mobile-entry>.purchase-card-title { height:auto!important; min-height:44px!important; overflow:visible!important; padding-right:46px!important; }
 #purchase-list .purchase-card.mobile-entry h2 { white-space:normal!important; overflow:visible!important; line-height:1.4!important; }
 #purchase-list .purchase-card.mobile-entry>.mobile-summary { height:auto!important; min-height:36px; padding-top:6px!important; }
 #purchase-list .mobile-meta { white-space:normal; overflow:visible; line-height:1.45; }
 #purchase-list .purchase-card .purchase-actions { align-items:stretch; }
 #purchase-list .purchase-card .purchase-actions>.button { flex:1 1 150px; }
 .purchase-toolbar .filter-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; overflow:visible; }
 .purchase-toolbar .filter-tabs button { white-space:normal; line-height:1.4; padding:8px 0; }
 #sourcing-table tr.mobile-entry>td:first-child { height:auto!important; min-height:44px; overflow:visible; }
 #sourcing-table tr.mobile-entry td:first-child strong { white-space:normal!important; line-height:1.45!important; overflow:visible; }
 #dispatches-view .dispatch-row>summary { display:grid; grid-template-columns:minmax(0,1fr) 22px; gap:8px; height:auto; }
 #dispatches-view .dispatch-row-name { grid-column:1; }
 #dispatches-view .dispatch-row-qty { grid-column:1; display:flex; align-items:baseline; gap:10px; text-align:left; }
 #dispatches-view .dispatch-row-qty small { max-width:none; margin:0; }
 #dispatches-view .dispatch-row>summary>span:last-child { grid-column:2; grid-row:1 / span 2; align-self:center; }
}
