/* Documents (public/js/documents.js): quotations, invoices, receipts and delivery notes */

/* "For the attention of": the company's people a document is for */
.attn-box { border: 1px solid var(--border); border-radius: 10px; padding: .4rem .8rem .6rem; display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; }
.attn-box legend { padding: 0 .3rem; font-weight: 600; font-size: .9rem; }
.attn-row { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; cursor: pointer; }
.paper .attn { font-size: .92em; }

/* Changes to an issued invoice: requested, checked, approved */
.card .change-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.change-list li { display: grid; gap: .3rem; padding-bottom: .8rem; border-bottom: 1px solid var(--border); }
.change-list li:last-child { border-bottom: 0; padding-bottom: 0; }
/* Change manufacturer window: what moves, what stays, and any refusal */
.mfr-preview { flex: 1 1 100%; width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .75rem; background: var(--surface); }
.mfr-preview p { margin: .25rem 0; }
.mfr-preview .mfr-move strong { color: var(--ok); }
.mfr-preview .mfr-stay strong { color: var(--copper, var(--accent)); }
.mfr-preview .mfr-error { color: var(--danger); }
.change-diff { border-collapse: collapse; font-size: .88rem; width: 100%; table-layout: fixed; }
.change-diff td { overflow-wrap: anywhere; white-space: normal; }
.change-diff th { width: 5.5rem; }
.change-diff th { text-align: left; font-weight: 600; padding: .15rem .6rem .15rem 0; white-space: nowrap; vertical-align: top; }
.change-diff td { padding: .15rem .6rem .15rem 0; vertical-align: top; }
.change-diff .was { color: var(--muted); text-decoration: line-through; }
.change-waiting { border-left: 4px solid var(--accent, #c2410c); }
.form .attn-row { display: flex; flex-direction: row; justify-content: flex-start; text-align: left; }
.attn-row input { width: auto; flex: none; margin: 0; padding: 0; }

/* Documents by person: who and when, with their totals */
.doc-analysis { display: grid; gap: .8rem; margin-bottom: .8rem; }
.doc-filters { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; }
.doc-filters .field { width: auto; flex: 1 1 11rem; }

/* The document list: numbers on one line, and the longer DD/MM/YYYY dates fit */
.doc-row .o-id { white-space: nowrap; }
.doc-row .o-who small { white-space: normal; }
@media (min-width: 1000px) { .doc-row { grid-template-columns: 6rem minmax(0, 2fr) 6rem 6.5rem 6rem 6rem minmax(0, 1.4fr); } }

/* Who made it, who changed it last and the sales person, stacked in the list's last column (GAKA 1.82.0) */
.doc-row .doc-who { display: grid; gap: .1rem; min-width: 0; line-height: 1.3; }
.doc-row .doc-who > span { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Narrow pages (a customer's page, a load): too tight for the table's last column, so who made it, who changed it and
   the sales person get their own full line under each row (GAKA 1.82.2). The CEO: "make it fully visible". */
@media (min-width: 1000px) {
  .page.narrow .order-row { grid-template-columns: 4rem minmax(0, 2.2fr) 1.2fr 7rem 9rem 7rem; grid-template-areas: "id cust qty total status date" "who who who who who who"; }
  .page.narrow .doc-row { grid-template-columns: 6rem minmax(0, 2fr) 6rem 6.5rem 6rem 6rem; }
  .page.narrow .order-row .o-who { white-space: normal; overflow: visible; text-overflow: clip; padding-top: .15rem; }
  .page.narrow .doc-row .doc-who { display: flex; flex-wrap: wrap; gap: .1rem 1.2rem; }
  .page.narrow .doc-row .doc-who > span { white-space: normal; overflow: visible; }
}

/* GAKA 1.88.1: a typed quantity above what the chosen trucks carry */
.ed-cap-hint { display: block; font-size: .72rem; line-height: 1.2; margin-top: .2rem; }
.ed-cap-hint:empty { display: none; }
/* GAKA 1.88.3: the unit beside a line's quantity in the editor */
.ed-unit { display: block; font-size: .72rem; margin-top: .15rem; }
.ed-unit:empty { display: none; }
/* Laptops and tablets on their side (1000-1279 px, GAKA 1.88.7): the who / changed / sales column was cut ("By Tendai (demo s…");
   it gets its own full line under each row, as on narrow pages */
@media (min-width: 1000px) and (max-width: 1279px) {
  .doc-row { grid-template-columns: 6rem minmax(0, 2fr) 6rem 6.5rem 6rem 6rem; grid-template-areas: "id cust qty total status date" "who who who who who who"; }
  .doc-row .doc-who { display: flex; flex-wrap: wrap; gap: .1rem 1.2rem; }
  .doc-row .doc-who > span { white-space: normal; overflow: visible; }
}

/* Transport per truck and lines typed by hand (GAKA 1.104.0) */
/* The price per truck (GAKA 1.109.0): its own row under the transport line, boxes side by side and wrapping to the next
   line as trucks are added; "Same price for all trucks" first */
.ed-t-prices-row > td { padding-top: 0; }
.ed-t-prices-wrap { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: flex-start; }
.ed-t-all { display: grid; gap: .15rem; padding-right: 1rem; border-right: 1px solid var(--line, #d9dde6); }
.ed-t-all-row { display: flex; gap: .35rem; }
.ed-t-all-row input { width: 8rem; }
.ed-t-prices { display: flex; flex-wrap: wrap; gap: .6rem; }
.ed-t-price { display: grid; grid-template-columns: minmax(0, 1fr); gap: .15rem; width: 9.5rem; }
.ed-t-price input { width: 100%; }
.ed-t-price > small:first-child { font-weight: 600; }
.ed-t-hint { font-size: .72rem; white-space: normal; overflow-wrap: anywhere; }
.ed-own { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .35rem; align-items: end; }
.ed-own > label:not(.check) { display: grid; gap: .1rem; flex: 1 1 7rem; min-width: 0; }
.ed-own-save { flex-basis: 100%; font-size: .85rem; }
.ed-add { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Item numbers on the document (GAKA 1.109.0) */
.p-items .p-no { width: 2.2rem; text-align: center; color: var(--muted, #5b6475); }

/* ZiG (GAKA 1.110.0): the total in ZiG under a USD document's total, and in the editor's totals */
.ed-zig { color: var(--muted, #5b6475); }
