/* ==========================================================================
   Modules 376–379 — an order's documents, material-quote payments and
   purchase orders, client logistics. Brand tokens only.
   ========================================================================== */
/* 376 — documents on an order, and "From the order" on a shipment */
.od-box { margin: 14px 0; padding: 12px 14px; background: #fff; border: 1px solid var(--ac-sand-light, #EAE2D2); border-radius: 6px; }
.od-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.od-head .subsection-title { margin: 0; }
.od-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--ac-sand-pale, #F1EBDD); }
.od-row:last-of-type { border-bottom: 0; }
.od-type { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ac-ink-soft, #5E665C); }
.od-name { min-width: 0; overflow-wrap: anywhere; }
.od-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.od-missing { color: var(--ac-error, #8C4A3C); font-size: 12px; }
.od-hint { margin: 8px 0 0; }
.od-order + .od-order { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--ac-sand-light, #EAE2D2); }
.od-order-h { margin-bottom: 4px; }
@media (max-width: 640px) { .od-row { grid-template-columns: 1fr; gap: 4px; } .od-acts { justify-content: flex-start; } }

/* 377 — payments */
.mqp-pay, .mqp-orders { margin: 14px 0; padding: 12px 14px; background: #fff; border: 1px solid var(--ac-sand-light, #EAE2D2); border-radius: 6px; }
.mqp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mqp-head .subsection-title { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mqp-pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 500; white-space: nowrap; text-transform: none; letter-spacing: 0; }
.mqp-pill.paid { background: #E3ECE5; color: var(--ac-success, #3E6B4F); }
.mqp-pill.part { background: #F3EAD3; color: #7A5E1F; }
.mqp-pill.due { background: var(--ac-sand-pale, #F1EBDD); color: var(--ac-ink-soft, #5E665C); }
.mqp-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.mqp-table th { text-align: left; font-weight: 500; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ac-ink-soft, #5E665C); padding: 6px 8px; border-bottom: 1px solid var(--ac-sand, #D8CCB4); }
.mqp-table td { padding: 7px 8px; border-bottom: 1px solid var(--ac-sand-pale, #F1EBDD); vertical-align: top; }
.mqp-table .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mqp-table tfoot td { font-weight: 600; border-bottom: 0; }
.mqp-table tr.gone td { text-decoration: line-through; color: var(--ac-ink-soft, #5E665C); }
.mqp-table tr.gone td:last-child, .mqp-table tr.gone .hint { text-decoration: none; }
.mqp-ready { margin: 8px 0 0; color: var(--ac-success, #3E6B4F); font-weight: 500; }
.mqp-go { box-shadow: 0 0 0 3px rgba(62, 107, 79, .18); }
/* 379 — purchase orders on the quote */
.mqp-po { padding: 10px 0; border-bottom: 1px solid var(--ac-sand-pale, #F1EBDD); }
.mqp-po:last-of-type { border-bottom: 0; }
.mqp-po-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mqp-po-acts { margin-left: auto; display: flex; gap: 6px; }
.mqp-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 6px 0 4px; }
.mqp-steps li { font-size: 11.5px; padding: 2px 8px; border-radius: 10px; background: var(--ac-sand-pale, #F1EBDD); color: var(--ac-ink-soft, #5E665C); }
.mqp-steps li.done { background: #E3ECE5; color: var(--ac-success, #3E6B4F); }
.mqp-steps li.now { background: var(--ac-green, #1E3D2B); color: var(--ac-ivory, #F6F2E8); }
.mqp-missing { margin-top: 10px; padding: 10px 12px; background: #F3EAD3; border-radius: 6px; font-size: 13px; }
.mqp-misrow { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 6px; flex-wrap: wrap; }
.mqp-misrow select { min-width: 220px; }
.mqp-cust { margin-top: 12px; }
.mqp-cust-total { font-weight: 600; }
.mqp-modal, .cl-modal { position: fixed; inset: 0; background: rgba(31, 36, 30, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 4000; overflow-y: auto; }
.mqp-card, .cl-card { background: #fff; border-radius: 8px; padding: 18px 20px; width: min(460px, 100%); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.18); }
.cl-card.wide { width: min(720px, 100%); }
.mqp-card h3, .cl-card h3 { margin: 0 0 4px; font-family: var(--font-display, 'Cormorant Garamond', Garamond, serif); font-weight: 600; font-size: 22px; }
.mqp-card label, .cl-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.mqp-actions, .cl-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.mqp-err, .cl-err { color: var(--ac-error, #8C4A3C); margin: 0; }

/* 378 — client logistics */
.cl-line { margin: 6px 0 10px; padding: 8px 12px; background: var(--ac-green-tint, #E7EDE8); border-radius: 6px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cl-pbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0 4px; }
.cl-pbar .hint { margin-right: auto; }
.cl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.cl-grid .span2 { grid-column: 1 / -1; }
.cl-contacts { display: flex; flex-direction: column; gap: 8px; }
.cl-crow { display: grid; grid-template-columns: 170px 1fr 1fr 1fr; gap: 6px; padding: 8px; border: 1px solid var(--ac-sand-light, #EAE2D2); border-radius: 6px; align-items: center; }
.cl-crow .cl-wa { flex-direction: row; align-items: center; gap: 6px; }
.cl-userrow { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
/* Module 147 hid the card's write buttons from readers; these are the ones a reader with the logistics right gets back. */
body.client-readonly #sales-customers .cl-pbar, body.client-readonly #sales-customers .cl-line, body.client-readonly #sales-customers [data-cl-newprop] { display: flex; }
body.client-readonly #sales-customers [data-cl-newprop] { display: inline-flex; }
@media (max-width: 640px) { .cl-grid { grid-template-columns: 1fr; } .cl-crow { grid-template-columns: 1fr 1fr; } }
/* Deleting and the sales actions stay commercial — the server refuses them for a reader (module 378), so a reader is not offered them. */
body.client-readonly #sales-customers [data-action="delete-customer"],
body.client-readonly #sales-customers [data-action="delete-property"],
body.client-readonly #sales-customers .client-actions { display: none !important; }
