/* cim360-purchasing.css — what the purchasing screens still draw by hand.

   GLOBAL, not scoped, and for the reason css/cards/cim360-card.css and css/lists/cim360-list.css
   both record: Blazor rewrites a .razor.css selector to the component that WROTE the markup, so a
   class shared by eight components would have to be copied into eight stylesheets and would drift
   between them. Every class here is used by more than one purchasing component — .po-receive-input
   alone appears in the receive, despatch, invoice and line dialogs and on the new-document screen.

   It must be linked in BOTH hosts (Cim360.cloud.Web/Components/App.razor and
   Cim360.cloud/wwwroot/index.html) or the screens style on one and not the other.

   WHAT IS NOT HERE, deliberately:

     - The card shell. The purchase card uses .c360-rcs-* from css/cards/cim360-card.css, the same
       chrome the sales card and the delivery card use. It drew its own for a fortnight against
       .po-card-* classes that existed in no stylesheet at all, which is what "looks nothing like
       the sales card" was.
     - Dialog chrome. Every purchasing dialog is a Cim360ConfirmDialog, styled by
       css/forms/cim360-dialog.css.
     - Table chrome. The in-card tables carry .c360-ct and .c360-grid-table, from the card sheet.

   What remains is the handful of modifiers those shared pieces do not and should not know about:
   a numeric cell, a narrow numeric input, a note under a table, and the two panels drawn outside
   any of the shared shells. */


/* ── Numbers in an entry table ───────────────────────────────────────────────────────────────── */

/* Right-aligned so digits line up by place value — the same rule the grid applies to a numeric
   column, applied here because these tables are hand-written rather than grid-generated. */
.po-receive-num {
    text-align: right;
    white-space: nowrap;
}

/* Narrow, because a quantity is four characters and a full-width box in a six-column row pushes
   the item description off the end. Right-aligned to match the cell it sits in: a number typed
   left-aligned above a column of right-aligned ones reads as a different column. */
.po-receive-input {
    max-width: 6.875rem;
    text-align: right;
}

/* The item's description under its code, in one cell. Muted and smaller: the code is what somebody
   matches against the delivery note, and the description is there to confirm it. */
.po-receive-desc {
    margin-top: 2px;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--cim360-text-muted);
}

/* The sentence under an entry table saying the server computes the totals. Said once per screen
   rather than beside every figure. */
.po-receive-note {
    margin: 0.5rem 0 0;
    font-size: 0.7813rem;
    line-height: 1.5;
    color: var(--cim360-text-muted);
}


/* ── Refusals inside a dialog ────────────────────────────────────────────────────────────────── */

/* The server's own message, inline, with the dialog still open and everything typed still in it —
   the project's dialog refusal convention. Red on its own tint rather than red text alone: a
   sentence in red inside a form reads as a field hint, which is the opposite of what it is. */
.po-reason-error {
    /* One refusal per document, each on its own line - DEV-765..772. */
    white-space: pre-line;
    margin-top: 0.625rem;
    padding: 0.5625rem 0.6875rem;
    border: 1px solid var(--cim360-danger-border);
    border-radius: 0.5rem;
    background: var(--cim360-danger-bg);
    color: var(--cim360-danger-fg);
    font-size: 0.7813rem;
    line-height: 1.5;
}

/* The one multi-line field in the family — a rejection, hold or cancellation reason. */
.po-reason-text {
    min-height: 4.5rem;
    resize: vertical;
}


/* ── The new-document screen ─────────────────────────────────────────────────────────────────── */

/* Drawn outside the card shell on purpose: this is a draft with no reference, no status and no
   totals, so the stripe, the summary band and the tab rail would all be empty chrome. It keeps the
   card's HEADER and FOOTER, which is what makes it read as the same family. */
.po-new {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: var(--cim360-card);
}

.po-new-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding: 1rem 1.125rem;
    overflow: auto;
}

/* The line table's own columns. Item and description take the room; the three numerics are sized
   to their content so a twelve-line order does not scroll sideways. */
.po-new-table th:nth-child(1),
.po-new-table td:nth-child(1) { width: 18%; }

.po-new-table th:nth-child(2),
.po-new-table td:nth-child(2) { width: auto; }

.po-new-table th:nth-child(3),
.po-new-table td:nth-child(3),
.po-new-table th:nth-child(4),
.po-new-table td:nth-child(4),
.po-new-table th:nth-child(5),
.po-new-table td:nth-child(5) { width: 8.125rem; }

.po-new-table th:last-child,
.po-new-table td:last-child { width: 2.75rem; }

/* The banner on the new screen, which has no card shell to hang a .c360-rcs-note on. Same shape as
   that note so the two read alike. */
.po-card-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin: 0.75rem 1.125rem 0;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--cim360-warning-border);
    border-radius: 0.5rem;
    background: var(--cim360-warning-bg);
    color: var(--cim360-warning-fg);
    font-size: 0.7813rem;
    line-height: 1.5;
}

.po-card-banner > i {
    margin-top: 1px;
    font-size: 0.875rem;
}

.po-card-banner-danger {
    border-color: var(--cim360-danger-border);
    background: var(--cim360-danger-bg);
    color: var(--cim360-danger-fg);
}


/* ── The card's action bar ───────────────────────────────────────────────────────────────────── */

/* GONE, and nothing replaces it. The card drew the document's lifecycle - receive, invoice,
   authorise, hold, cancel - as a row of buttons above the summary, which put twelve controls where
   the reader was looking for the order. The list's row menu reaches every one of them and opens the
   card with the action already running, so the bar was a second way in rather than the only one.

   Removed on request, 2026-09-14: "I don't want any options appearing there."

   The rule it leaves behind: the card is for READING a document and amending it. Edit and Close in
   the footer are its MODE; anything done TO the document is reached from the list. */


/* ── The card's line bar ─────────────────────────────────────────────────────────────────────── */

/* Under the lines table, not in its header: the header says what the table is, and the controls act
   on the row that is selected in it. Actions left, totals right - the arrangement the sales card
   uses, so a reader moving between the two finds the same things in the same places. */
.po-linebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--cim360-border);
    border-top: none;
    border-radius: 0 0 0.625rem 0.625rem;
    background: var(--cim360-surface, var(--cim360-surface-2));
}

.po-linebar-acts {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Why the buttons are not there, when they are not. A sentence rather than four greyed controls:
   "you may not" and "not on this document" look identical when both are greyed. */
.po-linebar-why {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.7813rem;
    color: var(--cim360-text-muted);
}

.po-linebar-totals {
    display: flex;
    align-items: baseline;
    gap: 1.125rem;
    margin-left: auto;
}

.po-linebar-tot {
    display: inline-flex;
    align-items: baseline;
    gap: 0.375rem;
    font-size: 0.7813rem;
}

.po-linebar-tot em {
    font-style: normal;
    color: var(--cim360-text-muted);
}

.po-linebar-tot b {
    font-variant-numeric: tabular-nums;
}

/* The one figure somebody came to read. */
.po-linebar-tot.is-grand b {
    font-size: 0.875rem;
    font-weight: 700;
}


/* ── The card's Log tab ──────────────────────────────────────────────────────────────────────── */

/* A conversation rather than a grid. Notes on a purchase document are read in order and are mostly
   a sentence or two, and a five-column table of one-sentence rows wastes the width on chrome.

   Oldest first, which the server decides - a reply above the thing it answers reads backwards. */
.po-log {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.po-log-item {
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--cim360-border);
    border-left: 0.1875rem solid var(--cim360-primary);
    border-radius: 0.5rem;
    background: var(--cim360-card);
}

/* A system note is quieter, because it records that something happened where a person's note
   records what somebody decided about it. Muted rather than hidden: the two read together as the
   history of the document. */
.po-log-item.is-system {
    border-left-color: var(--cim360-border);
    background: var(--cim360-surface, var(--cim360-surface-2));
}

.po-log-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
    font-size: 0.7813rem;
}

.po-log-when {
    color: var(--cim360-text-muted);
    font-size: 0.75rem;
}

/* The Log's Add - DEV-761. A panel above the entries, the category picked first because it is
   what the entry is filed under. */
.po-log-add {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--cim360-border);
    border-radius: 0.5rem;
    background: var(--cim360-surface-2);
}

.po-log-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

/* 2.5.8: each chip is at least 24px tall, with room around it. */
.po-log-cat {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 1.875rem;
    padding: 0 0.75rem;
    border: 1px solid var(--cim360-border);
    border-radius: 62.4375rem;
    background: var(--cim360-card);
    color: var(--cim360-text);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.po-log-cat.active {
    border-color: var(--cim360-primary);
    background: var(--cim360-primary);
    color: var(--cim360-on-primary);
}

.po-log-cat:focus-visible {
    outline: 2px solid var(--cim360-primary);
    outline-offset: 2px;
}

.po-log-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--cim360-text-muted);
}

.po-log-text {
    resize: vertical;
    min-height: 4.5rem;
}

.po-log-acts {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.po-log-acts.is-start {
    justify-content: flex-start;
    margin-bottom: 0.75rem;
}

.po-log-head .c360-pill i {
    margin-right: 0.25rem;
}

.po-log-body {
    font-size: 0.8125rem;
    line-height: 1.55;

    /* A note typed with line breaks keeps them, and a long unbroken reference still wraps rather
       than widening the whole tab. */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}


/* ── A grid that threw while rendering ───────────────────────────────────────────────────────── */

/* The list's ErrorBoundary panel. A sentence and the reason rather than a blank panel: somebody who
   can see what broke can tell somebody else, and an empty grid is indistinguishable from no data. */
.po-grid-error {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin: 1rem;
    padding: 1.125rem 1.25rem;
    border: 1px solid var(--cim360-danger-border);
    border-radius: 0.625rem;
    background: var(--cim360-danger-bg);
    color: var(--cim360-danger-fg);
}

.po-grid-error > i {
    margin-top: 2px;
    font-size: 1.125rem;
}

.po-grid-error-detail {
    margin-top: 0.25rem;
    font-size: 0.7813rem;
    line-height: 1.5;
    opacity: .9;
}


/* ── The receive screen's two extra columns ────────────────────────────────────────────────────

   The goods receive dialog IS the sales despatch dialog and wears its classes - .soa-table,
   .soa-col-item, .soa-col-desc, .soa-col-n, .soa-col-take, .soa-takecell, .soa-pick, .soa-chip, all
   from css/forms/cim360-dialog.css. Only two columns have no counterpart on the selling side, and
   they are the whole of what is here.

   BOTH SELECTORS CHAIN .c360-grid-table where they override it. A bare .po-rcv-col-bin is one class
   and ties with .c360-grid-table tbody td, which is declared in a file loaded after this one - so
   it would lose on source order, silently. The dialog sheet records the same trap against
   .soa-table, which is where the rule came from. */

/* REJECTED, its own column rather than a second box in the quantity cell. It is a different
   question from "how much came" - somebody counts a delivery, then inspects it - and a screen that
   put both numbers in one cell would read as two halves of one figure.

   Wider than .soa-col-n's 100px because it holds a Cim360NumberWithUnit rather than text: the
   control's own chrome is about 40px before a digit is drawn. */
.c360-grid-table.soa-table .po-rcv-col-rej {
    width: 9.375rem;
    text-align: right;
}

/* WHERE IT WENT. Wide enough for a bin name and the button beside it; the full warehouse path is in
   the title and in the picker, because a cell repeating "Main Warehouse" on every row says nothing
   that distinguishes the rows. 12.5rem rather than the 14.375rem it had before Traced stock took a
   column of its own (DEV-774): the name clips with an ellipsis and keeps its title. */
.c360-grid-table.soa-table .po-rcv-col-bin {
    width: 12.5rem;
}

/* RECEIVE NOW, narrower than .soa-col-take's 13.75rem. That width carries the 28px batch button
   beside the box; here the button moved into Traced stock (DEV-774), and the 40px it frees is the
   room that column takes, so the dialog keeps its width with no horizontal scroll. */
.c360-grid-table.soa-table .po-rcv-col-take {
    width: 11.25rem;
}

.po-rcv-bincell {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.375rem;
}

/* One line, clipped rather than wrapped. A bin name that wrapped would grow the row, and every row
   in the table is otherwise the height of its description cell. */
.po-rcv-binname {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* "Inventory decides" is a real answer and not a missing one, so it recedes rather than shouting -
   the same muted treatment a placeholder gets, on text that is doing a placeholder's job. */
.po-rcv-binname.is-default {
    color: var(--cim360-text-muted);
    font-style: italic;
}


/* ── The location picker's list ────────────────────────────────────────────────────────────────

   A radio group drawn as rows, because the question is "which one" and the answers are two lines
   each - a bin name and the warehouse path that tells two same-named bins apart. A <select> would
   fit the first line and lose the second, which is the line that disambiguates. */

.po-rcv-locs {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    max-height: 46vh;
    overflow: auto;
}

.po-rcv-loc {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5625rem 0.6875rem;
    border: 1px solid var(--cim360-border);
    border-radius: 0.5rem;
    background: var(--cim360-card);
    color: var(--cim360-text);
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.po-rcv-loc:hover {
    border-color: var(--cim360-primary);
    background: color-mix(in srgb, var(--cim360-primary) 6%, transparent);
}

/* The chosen row carries the brand colour on its border and mark. NOT on its background alone:
   colour is never the only carrier of state here, and the filled radio glyph says the same thing
   to a reader who cannot see the tint. */
.po-rcv-loc.is-on {
    border-color: var(--cim360-primary);
    background: color-mix(in srgb, var(--cim360-primary) 10%, transparent);
}

.po-rcv-loc-mark {
    flex: 0 0 auto;
    margin-top: 1px;
    color: var(--cim360-text-muted);
    font-size: 0.9375rem;
    line-height: 1;
}

.po-rcv-loc.is-on .po-rcv-loc-mark {
    color: var(--cim360-primary);
}

.po-rcv-loc-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.po-rcv-loc-name {
    font-weight: 600;
    font-size: 0.8125rem;
}

.po-rcv-loc-path {
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--cim360-text-muted);
}

.po-rcv-loc-empty {
    padding: 1.125rem 0.5rem;
    color: var(--cim360-text-muted);
    text-align: center;
    font-size: 0.7813rem;
}


/* ── Narrow screens ──────────────────────────────────────────────────────────────────────────── */

@media (max-width: 820px) {
    /* The width cap is what makes these readable in a row; on a narrow screen the row has already
       stacked and the cap just makes the field hard to hit. */
    .po-receive-input { max-width: none; }

    .po-new-body { padding: 0.75rem; }

    .po-card-banner { margin: 0.625rem 0.75rem 0; }
}

/* ── The card's Deliveries tab ─────────────────────────────────────────────────────────────────

   A GRID, the same shape as the sales card's Fulfilment tab: tiles across the top, then one table
   of deliveries with each delivery's lines beneath it as child rows. The tiles, the tree's child
   rows and the row icon buttons are all shared - css/cards/cim360-card.css.

   It was a list of cards, one per delivery, with its own header block above its own table. That
   reads well for one delivery and badly for six: nothing lines up between them, so comparing two
   dates or two carriers meant reading two blocks of prose. Reported 2026-09-14 - "it isn't a grid,
   you have implemented a 'kpi' style card". What is left here is only what is genuinely this
   table's. */

/* The chevron, the state icon and the schedule number on one line - three inline items in one cell
   wrap at a narrow width and the caret ends up above the code it opens. */
.po-dlv-col-num { white-space: nowrap; }

/* A goods-received note's reprint, beside its number in the GRN tree. DEV-757. */
.po-grn-print { margin-left: 0.375rem; vertical-align: middle; }

/* A delivery that is finished or dropped, marked down the row rather than tinted across it: the
   figures in the row still have to be read, and a wash over them costs contrast (1.4.3). */
.c360-ct > tbody > tr.is-received > td:first-child { box-shadow: inset 0.1875rem 0 0 var(--cim360-success); }
.c360-ct > tbody > tr.is-partial > td:first-child { box-shadow: inset 0.1875rem 0 0 var(--cim360-warning); }
.c360-ct > tbody > tr.is-cancelled > td:first-child { box-shadow: inset 0.1875rem 0 0 var(--cim360-muted-soft); }

/* A cancelled delivery's own number and status read quieter, because the row is a record of a plan
   that was dropped - but only those two cells, for the reason above. */
.c360-ct > tbody > tr.is-cancelled .c360-ct-code { text-decoration: line-through; }

/* ── The plan/amend delivery dialog ────────────────────────────────────────────────────────────

   The line picker. A table rather than a list of rows with labels: the reader is comparing what is
   outstanding on each line against what they are about to promise, and that is a column job. */
.po-dlv-lines {
    max-height: 20rem;
    overflow-y: auto;
    border: 1px solid var(--cim360-border);
    border-radius: 0.5rem;
}

.po-dlv-lines table { width: 100%; }

.po-dlv-pick {
    width: 2.125rem;
    text-align: center;
}

/* Wide enough for a five-figure quantity with two decimals, and no wider - a full-width box in a
   narrow column reads as a text field rather than a number. */
.po-dlv-qty {
    width: 6rem;
    text-align: right;
}

/* The picked rows, so a reader scrolling a long order can see what they have chosen without
   reading every checkbox. */
.po-dlv-lines tr.is-picked { background: rgba(14, 165, 233, .06); }

/* The line above a delivery's lines: the supplier's instructions and how many receipts have been
   booked. Neither is a column - an instruction is a sentence, and a receipt count beside ten
   figures reads as another quantity - so they sit on the row that opens, with the delivery they
   describe. */
.po-dlv-childnote > td {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    color: var(--cim360-text-muted);
}

.po-dlv-note,
.po-dlv-receipts {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.po-dlv-note { font-style: italic; }

.po-dlv-note > i,
.po-dlv-receipts > i { opacity: .8; }

/* ---- Purchase Documents list cells - DEV-741 -------------------------------------------------- */

/* The link marker beside a document's reference: a count of the documents it was raised from or
   converted to. Muted ink, because the reference is what the eye should land on first. */
.po-link-marker {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    margin-left: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cim360-text-muted);
    white-space: nowrap;
}

/* The Drop-ship chip after the supplier's name, kept on the name's line. */
.po-drop-ship-chip {
    display: inline-flex;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Due In: bold while due within three days, amber ink with a warning mark when the supplier has
   promised later than requested. Weight and the mark carry the meaning, not the colour alone. */
.po-due-in.is-soon { font-weight: 700; }

.po-due-in.is-late {
    font-weight: 700;
    color: var(--cim360-warning-fg);
}

.po-due-in > i { margin-left: 0.25rem; font-size: 0.625rem; }

/* The dash in an empty Hold cell. */
.po-cell-none { color: var(--cim360-text-muted); }

/* ---- The purchase document card's shell - DEV-753 ------------------------------------------ */

/* Approved by, the hold and why, acknowledged, declined: after the status on the stripe, as
   secondary text rather than a second label shouting in capitals. */
.po-stripe-fact {
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}

.po-stripe-fact .sep { margin-right: 0.375rem; }

/* On-time and rejection beside the supplier line, on the blue band. A DARK wash, never a light one:
   white text on a translucent-white chip over the band measured 3.66:1, where the bare band is 4.87:1
   and a dark tint only adds to it. */
.po-perf {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    margin-left: 0.625rem;
    padding: 0.0625rem 0.5rem;
    border-radius: 999rem;
    background: rgba(0, 0, 0, .12);
    font-size: 0.7188rem;
    font-weight: 700;
    white-space: nowrap;
}

/* The authorisation bar: reasons on the left, Authorise and Decline on the right. */
.po-auth-bar { align-items: center; }
.po-auth-text { flex: 1 1 auto; }
.po-auth-blocks { display: block; margin-top: 0.125rem; font-weight: 500; }
.po-auth-acts { display: inline-flex; gap: 0.5rem; flex: 0 0 auto; }
.po-auth-noright { flex: 0 0 auto; font-weight: 500; font-style: italic; }

/* The card's totals break down on hover and on keyboard focus, as the New window's line bar does -
   the same c360-dlb-pop panel, opening upwards from its figure. */
.po-tot { position: relative; cursor: default; }
.po-tot:hover .po-tot-pop,
.po-tot:focus-within .po-tot-pop,
.po-tot:focus .po-tot-pop { display: block; }

/* Read-only in Edit's place on the card footer, with the reason on hover and in the note. */
.po-readonly { display: inline-flex; align-items: center; color: var(--cim360-text-muted); font-size: 0.8125rem; font-weight: 600; }

/* The quieter second line under a reference - an invoice's kind and who posted it, the invoice a
   payment settles, an item's description in the three-way match. DEV-758. */
.po-inv-sub {
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--cim360-text-muted);
}

/* The Addresses tab's delivery source bar - DEV-760. From warehouse / One-off address, the goods-in
   warehouse, and a note saying what the choice means. */
.po-addr-src {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.75rem;
}

.po-addr-seg {
    display: inline-flex;
    border: 1px solid var(--cim360-border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.po-addr-seg button {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2rem;
    padding: 0 0.75rem;
    border: 0;
    background: var(--cim360-card);
    color: var(--cim360-text);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.po-addr-seg button + button {
    border-left: 1px solid var(--cim360-border);
}

.po-addr-seg button.active {
    background: var(--cim360-primary);
    color: var(--cim360-on-primary);
}

.po-addr-seg button:disabled {
    cursor: default;
}

.po-addr-seg button:disabled:not(.active) {
    color: var(--cim360-text-muted);
}

.po-addr-seg button:focus-visible {
    outline: 2px solid var(--cim360-primary);
    outline-offset: -2px;
}

.po-addr-wh {
    min-width: 13rem;
}

.po-addr-whname {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

.po-addr-note {
    font-size: 0.75rem;
    color: var(--cim360-text-muted);
}

.po-addr-dropship {
    background: var(--cim360-warning-bg);
    color: var(--cim360-warning-fg);
    border-color: var(--cim360-warning-border);
}

.po-addr-contact {
    margin-top: 0.75rem;
}

/* ═══ RECEIPTS TAB (DEV-757) ══════════════════════════════════════════════════════════════════ */

/* The two filter strips side by side - the status segments, then the chase list. */
.po-dlv-segs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* The supplier's own date, beside the Due in date it marks. */
.po-dlv-promised {
    margin-left: 0.375rem;
    font-size: 0.6875rem;
}

/* On the chase list: red, because somebody should be on the phone. */
.po-dlv-chase-pill {
    margin-left: 0.25rem;
    background: var(--cim360-danger-bg);
    color: var(--cim360-danger-fg);
    border-color: var(--cim360-danger-border);
}

/* Due soon and not yet confirmed (Remind before due): amber - a date to confirm, not yet a problem. */
.po-dlv-duesoon-pill {
    margin-left: 0.25rem;
    background: var(--cim360-warning-bg);
    color: var(--cim360-warning-fg);
    border-color: var(--cim360-warning-border);
}

/* The deliveries list's status cell: the chip, then any reminder pill on the same line. */
.po-dlv-status-cell {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.po-dlv-grn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.po-dlv-grn em {
    font-style: normal;
    font-size: 0.6875rem;
    color: var(--cim360-text-muted);
}

.po-grn-wrap { margin-top: 0.875rem; }

/* Batches and serials as chips - one per lot, wrapping under each other on a long line. */
.po-grn-lots {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.po-grn-lot {
    display: inline-block;
    padding: 0.0625rem 0.4375rem;
    border: 1px solid var(--cim360-border);
    border-radius: 0.375rem;
    background: var(--cim360-surface-2, var(--cim360-card));
    font-size: 0.75rem;
    white-space: nowrap;
    cursor: help;
}

.po-grn-kv { margin: 0; }

.po-grn-lines { width: 100%; }

.po-grn-nofiles {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
}

.po-grn-files {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0.5rem;
}

.po-grn-file {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--cim360-border);
    border-radius: 0.5rem;
    background: var(--cim360-card);
    color: var(--cim360-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.po-grn-file:hover { border-color: var(--cim360-primary); }

.po-grn-file:focus-visible {
    outline: 2px solid var(--cim360-primary);
    outline-offset: 1px;
}

.po-grn-file > i {
    grid-row: 1 / span 2;
    font-size: 1.375rem;
    color: var(--cim360-primary);
}

.po-grn-file-name {
    font-size: 0.8125rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.po-grn-file-meta {
    font-size: 0.6875rem;
    color: var(--cim360-text-muted);
}

/* The viewer sits over the note's window - one above the dialog overlay's own 1060. */
.po-grn-viewer { z-index: 1061; }

.po-grn-viewer-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 12rem;
}

.po-grn-viewer-img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
}

.po-grn-viewer-none {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--cim360-text-muted);
}

.po-grn-viewer-none > i { font-size: 2.5rem; }

.po-grn-download { text-decoration: none; }

/* The Receive window's order heading, where several orders are received together. DEV-773. */
.po-rcv-group > th {
    background: var(--cim360-surface-2);
    color: var(--cim360-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: left;
    padding: 0.375rem 0.75rem;
}

.po-rcv-group i { margin-right: 0.375rem; }

/* The Receive window's paperwork chips. */
.po-rcv-files { flex-wrap: wrap; gap: 0.375rem; }

.po-rcv-file {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.po-rcv-file-x {
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0 0.125rem;
    cursor: pointer;
}

/* The note's window: what sits in a form section spans its whole twelve-column grid - a details
   list and a file list, not a row of fields (R-088 wants the span claimed per child). */
.po-grn-span { grid-column: 1 / -1; }

.po-grn-kv {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.625rem 1rem;
}

.po-grn-kv > div { min-width: 0; }

.po-grn-kv dt {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--cim360-caption);
}

.po-grn-kv dd {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

@container c360stack (max-width: 700px) {
    .po-grn-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ═══ CHANGE STATUS WINDOW (DEV-768) ═════════════════════════════════════════════════════════ */

.po-status-sect { margin-bottom: 0.75rem; }

.po-status-sect-h {
    margin-bottom: 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--cim360-caption);
}

.po-status-docs {
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 12rem;
    overflow-y: auto;
}

.po-status-docs > li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--cim360-border);
    font-size: 0.8125rem;
}

.po-status-sup {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--cim360-text-muted);
}

.po-status-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.po-status-target {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--cim360-border);
    border-radius: 0.5rem;
    background: var(--cim360-card);
    color: var(--cim360-text);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
}

.po-status-target:hover { border-color: var(--cim360-primary); }

/* A fill, so the surface token: --cim360-primary is the text token, which lightens in dark and put
   white on it at 2.72:1. */
.po-status-target.is-on {
    border-color: var(--cim360-primary-surface);
    background: var(--cim360-primary-surface);
    color: var(--cim360-on-primary);
}

.po-status-target:focus-visible {
    outline: 2px solid var(--cim360-primary);
    outline-offset: 2px;
}

.po-status-hint {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--cim360-text-muted);
}

/* Authorise / Decline over the selection - DEV-770. The orders, what each is worth and why it needs
   a decision. */
.po-auth-docs {
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 12rem;
    overflow-y: auto;
}

.po-auth-docs > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--cim360-border);
    font-size: 0.8125rem;
}

.po-auth-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.po-auth-why {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    width: 100%;
}

.po-auth-why > em {
    font-style: normal;
    font-size: 0.75rem;
    padding: 0 0.375rem;
    border-radius: 0.25rem;
    background: var(--cim360-surface-muted);
    color: var(--cim360-text-muted);
}

.po-auth-declined-why {
    font-weight: 600;
}

/* Place on order - DEV-771. The two ticks under the issue fields. */
.po-place-ticks {
    display: grid;
    gap: 0.375rem;
    margin: 0.5rem 0 0.75rem;
    font-size: 0.8125rem;
}

/* Each row at least a 24px target tall, floored in px because the UI scales (2.5.8): the box itself
   stays the browser's 13px, and passes on the clearance this gives it from the other tick. */
.po-place-ticks label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: max(1.5rem, 24px);
}

.po-place-ticks label.is-off {
    color: var(--cim360-text-muted);
}

/* Print now: a link per placed document, opened by the reader - DEV-771. */
.po-place-sheet {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
}

/* Despatch return - DEV-776/777. The receive dialog's table with one column of its own; chained on
   .c360-grid-table.soa-table for the source-order reason given above .po-rcv-col-rej. */
.c360-grid-table.soa-table .po-dsp-col-reason {
    width: 12.5rem;
}

/* Match supplier invoice - DEV-778. Nine columns once the match preview is beside the entry: the
   item, the price box and the match state each keep a floor, or the price box is squeezed to its
   currency sign and a chip breaks mid-word. */
.po-invoice-entry-table .po-inv-item-col { min-width: 10rem; }
.po-invoice-entry-table .po-inv-cost-col { min-width: 9rem; }
.po-invoice-entry-table .po-inv-match-cell { min-width: 11rem; }
.po-invoice-entry-table .po-inv-match-cell .cim-chip-text { overflow-wrap: normal; }
/* The price box is a number and its currency, not a quantity: .po-receive-input's 6.875rem left the
   number about 45px beside the sign. */
.po-invoice-entry-table .po-inv-cost-input { min-width: 9rem; }

/* Resolve invoice variance - DEV-779. The outcome and tolerance choices: radios, as on the sales
   credit dialog, because each is one answer from a short fixed list. The tolerances sit in a row. */
.piv-radio { display: flex; flex-direction: column; gap: 0.375rem; }
.piv-radio.piv-radio-row { flex-direction: row; flex-wrap: wrap; gap: 1.25rem; }
/* Beats .c360-dlg-field label (0,1,1, loaded later), which makes every label a full-width caption. */
.c360-dlg-field .piv-radio label {
    display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer;
    width: auto; margin-bottom: 0; font-weight: 400; color: var(--cim360-text);
}

/* Review requisitions - DEV-787. What is waiting on the left, the one in view and its lines on the right. */
.prr-split { display: grid; grid-template-columns: minmax(15rem, 20rem) 1fr; gap: 1rem; min-height: 24rem; }
.prr-list { display: flex; flex-direction: column; gap: 0.25rem; border-right: 1px solid var(--cim360-border); padding-right: 0.75rem; overflow-y: auto; max-height: 60vh; }
.prr-item { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.5rem; border-radius: 0.375rem; border: 1px solid transparent; }
.prr-item.is-selected { border-color: var(--cim360-primary); background: var(--cim360-surface-2); }
.prr-item-main { display: flex; flex-direction: column; align-items: flex-start; gap: 0.125rem; background: none; border: 0; padding: 0; text-align: left; color: var(--cim360-text); cursor: pointer; }
.prr-ref { font-weight: 600; }
.prr-meta { font-size: 0.75rem; color: var(--cim360-text-muted); }
.prr-detail { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }
.prr-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem 1rem; margin: 0; }
.prr-facts dt { font-size: 0.75rem; color: var(--cim360-text-muted); }
.prr-facts dd { margin: 0; color: var(--cim360-text); }
.prr-removed td { text-decoration: line-through; color: var(--cim360-text-muted); }
.prr-amend { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.prr-empty { padding: 2rem 0; text-align: center; color: var(--cim360-text-muted); }
@media (max-width: 760px) { .prr-split { grid-template-columns: 1fr; } .prr-list { border-right: 0; padding-right: 0; } }
