/* Recebimentos and Conferência de recebimento (wms-receiving): layout and colors only. Field/button sizes live in forms.css. */
.receivings-layout {
    grid-template-columns: minmax(380px, 1fr) minmax(0, 1.9fr)
}

@media(max-width:1100px) {
    .receivings-layout {
        grid-template-columns: 1fr
    }
}

.receiving-invoice {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.receiving-document {
    grid-template-columns: repeat(3, minmax(0, 1fr))
}

.receiving-document .user-field-wide {
    grid-column: span 2
}

@media(max-width:1300px) {
    .receiving-document {
        grid-template-columns: repeat(2, minmax(0, 1fr))
    }
}

.receiving-key {
    font-family: ui-monospace, monospace;
    letter-spacing: .02em;
    overflow-wrap: anywhere
}

.receiving-notes {
    resize: vertical
}

.profile-save.receiving-start {
    background: var(--button-primary);
    color: var(--on-button-primary)
}

.receiving-grid-wrap {
    max-height: 440px;
    margin-top: 10px
}

.stock-grid.receiving-grid th,
.stock-grid.receiving-grid td {
    padding: 7px 8px;
    vertical-align: top
}

.receiving-review-grid tr.is-divergent td {
    background: var(--warning-faint)
}

.receiving-review-grid tr.is-pending td:first-child {
    box-shadow: inset 3px 0 var(--warning)
}

.receiving-warning {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 4px;
    font-size: 9px;
    font-style: normal;
    font-weight: 600;
    color: var(--danger-text);
    background: var(--danger-soft);
    padding: 1px 6px;
    border-radius: var(--radius-sm)
}

/* Decision in the row of each item of the review (2026-10-08): a second table row under the item, one cell over every column, the controls in one line that
   wraps (choice ~150px + result + reason ~140px + note >=100px + "Sugestão" + Confirmar fit the ~700px of the grid in the 740px panel; narrower, they
   wrap instead of widening the table). Field and button heights (28px) are in forms.css. */
.receiving-grid-wrap.is-deciding {
    max-height: 640px
}

.receiving-review-grid tr.receiving-decide-row td {
    border-top: 0;
    padding-top: 0;
    white-space: normal
}

.receiving-decide {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px
}

.receiving-decide .receiving-decide-choice {
    width: auto;
    flex: 0 1 150px;
    min-width: 120px
}

.receiving-decide .receiving-decide-reason {
    width: auto;
    flex: 0 1 140px;
    min-width: 110px
}

.receiving-decide .receiving-decide-note {
    width: auto;
    flex: 1 1 100px;
    min-width: 100px
}

.receiving-decide-result {
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--success-text)
}

.receiving-decide-result.is-above {
    color: var(--danger-text)
}

.receiving-decide-result.is-below {
    color: var(--warning-text)
}

.receiving-decide-none {
    font-size: 10px;
    color: var(--text-muted)
}

.receiving-decide-suggested {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--primary-faint);
    color: var(--primary-text);
    white-space: nowrap
}

.receiving-decide-actions {
    display: inline-flex;
    gap: 6px;
    margin-left: auto
}

.receiving-decide-manual {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px 12px;
    margin-top: 6px
}

.receiving-decide-manual .receiving-manual-lines {
    flex: 1 1 320px;
    margin: 0
}

.receiving-decide-round {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 10px;
    color: var(--text-2)
}

.receiving-decide-round select {
    width: auto
}

.receiving-decide-error {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    white-space: normal;
    color: var(--danger-text)
}

.receiving-row-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 4px;
    padding: 0;
    border: 0;
    background: none;
    font-size: 9px;
    color: var(--primary-text);
    cursor: pointer
}

.receiving-row-link:disabled {
    opacity: .5;
    cursor: default
}

.receiving-decide-all {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0 0;
    font-size: 10px;
    color: var(--text-2)
}

.receiving-decide-all button {
    flex-shrink: 0
}

.receiving-manual-lines {
    list-style: none;
    margin: 10px 0;
    padding: 0;
    display: grid;
    gap: 6px
}

.receiving-manual-lines li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px;
    gap: 10px;
    align-items: center;
    font-size: 10px;
    color: var(--text-2)
}

.receiving-movements {
    margin: 12px 0 0;
    padding-left: 18px;
    font-size: 10px;
    line-height: 1.8;
    color: var(--text-2);
    overflow-wrap: anywhere
}

.receiving-preview .is-warning {
    color: var(--danger-text);
    display: flex;
    align-items: center;
    gap: 5px
}

.receiving-history li {
    border-left: 2px solid var(--border);
    padding: 2px 0 2px 10px;
    min-width: 0;
    font-size: 10px;
    color: var(--text-2)
}

.receiving-history strong {
    font-size: 10px;
    color: var(--text-2)
}

.receiving-entries {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px
}

.receiving-entries li {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    font-size: 10px;
    color: var(--text-2)
}

.receiving-entries li>span {
    min-width: 0;
    overflow-wrap: anywhere
}

.receiving-entry {
    /* The product column never gets narrower than its caption on one line ("Produto (código ou código de barras)": a 2-line caption pushed its
       field below the others) and the condition column never narrower than its two chips side by side (OK + Avariado); the other columns give way. */
    grid-template-columns: minmax(max-content, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, .8fr) minmax(max-content, 1.1fr) auto
}

.receiving-condition {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center
}

.receiving-condition-label {
    width: 100%;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 0
}

/* Receiving check: a locked receipt shows why under its title (visible on touch devices, not only in the tooltip). */
/* A blocked row of Conferência de recebimento (two-line row, 2026-10-08): the lock inside the code balloon, the reason under the supplier. */
.compact-row.is-locked > .compact-code .inventory-row-icon {
    vertical-align: -1px;
    color: inherit
}

.receiving-block-reason {
    font-size: 9px;
    line-height: 1.4;
    color: var(--text-faint);
    white-space: normal
}
/* Grid of the draft: product without batch control, no batch field (Blazor). */
.receiving-no-batch {
    color: var(--text-muted);
    font-size: 10px;
}

/* Condition OK/Avariado of the entry: the labels are .inventory-kind chips, but `.user-field label` (display:block) and `.inventory-entry .user-field label`
   (margin-bottom) won over .inventory-kind, so the radio sat above the text's center line. Keep the chip a centered inline flex row. */
.inventory-entry .receiving-condition label.inventory-kind {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
    line-height: 1;
    white-space: nowrap
}

.inventory-entry .receiving-condition label.inventory-kind input {
    margin: 0;
    vertical-align: middle
}

/* Caption on the first row, the two chips side by side on the second, each at least as wide as its text: the grid column of the entry
   (.receiving-entry, minmax(max-content, ...)) is never narrower than OK + Avariado, so no chip wraps or spills out of its box. */
.inventory-entry .receiving-condition {
    display: grid;
    grid-template-columns: repeat(2, minmax(max-content, 1fr));
    gap: 6px
}

.inventory-entry .receiving-condition .receiving-condition-label {
    grid-column: 1 / -1
}

/* Review grid in the ~660-740px panel (2026-10-08, browser check): with table-layout auto and the nowrap cells of .stock-grid, the counts column
   ("Sem lote · 31/10/2026 · OK × 3 | Sem lote · ...") made the table 858px in a 659px wrapper (horizontal scroll, the decision row too). Fixed layout
   with column widths; the cells break their text; the captions stay on one line. Columns: Produto, Esperado, 1ª contagem, 2ª contagem, Final, Decisão. */
.receiving-review-grid {
    table-layout: fixed;
    width: 100%
}

.receiving-review-grid th {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.receiving-review-grid td,
.receiving-review-grid td small,
.receiving-review-grid td strong {
    white-space: normal;
    overflow-wrap: anywhere
}

.receiving-review-grid thead th:nth-child(1) { width: 21% }
.receiving-review-grid thead th:nth-child(2) { width: 18% }
.receiving-review-grid thead th:nth-child(3) { width: 18% }
.receiving-review-grid thead th:nth-child(4) { width: 18% }
.receiving-review-grid thead th:nth-child(5) { width: 11% }
.receiving-review-grid thead th:nth-child(6) { width: 14% }

/* "Alterar" of a decided row on its own line under the decision badge (inline it went 24px past the Decisão column). */
.receiving-review-grid .receiving-row-link {
    display: flex
}

/* Phone width (validation r4 of the MCP foundation, 2026-10-09): the actions of the title of a receiving (report, situation, "Novo recebimento") went
   137px past a 375px screen; the title and its actions wrap to a second line instead. */
@media (max-width: 640px) {
    .profile-form-title:has(.receiving-title-actions) {
        flex-wrap: wrap
    }

    .receiving-title-actions {
        flex-wrap: wrap
    }
}

/* Batches and counted lines one per line (2026-10-22, user request): "lote · validade × quantidade" never joined by "," or "|". */
.receiving-line-list {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    font-size: 9px;
    line-height: 1.45;
    color: var(--text-faint)
}

.receiving-line-list li {
    overflow-wrap: anywhere
}

.receiving-review-grid td small.receiving-lines + .receiving-line-list {
    margin-top: 0
}

/* No wrap inside a batch line or a quantity (2026-10-22, user request; widths 21/18/18/18/11/14 % above): the damaged packs in red. */
.receiving-review-grid td .receiving-line-list li {
    white-space: nowrap;
    overflow-wrap: normal
}

/* A batch code is never cut: on a narrow panel the grid scrolls sideways inside its frame instead of wrapping or hiding part of a line. */
.receiving-review-grid {
    min-width: 740px
}

.receiving-review-grid .receiving-pair {
    white-space: nowrap
}

.receiving-damaged,
.receiving-line-list li.is-damaged {
    color: var(--danger-text)
}
