.seed-purchase-page {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.seed-purchase-lines-scroll {
    overflow-x: auto;
    width: 100%;
}

/* Each variant now only fixes the MINIMUM width (sum of every column except
   Item). Item has no declared width, so in a table-layout:fixed table it
   automatically absorbs all remaining horizontal space. Below the min-width,
   the container scrolls horizontally instead of crushing the columns. */
.seed-purchase-lines-scroll--seed {
    --seed-lines-min-width: 1020px;
}

    .seed-purchase-lines-scroll--seed.seed-purchase-lines-scroll--item-disc {
        --seed-lines-min-width: 1172px;
    }

.seed-purchase-lines-scroll--packed {
    --seed-lines-min-width: 1030px;
}

    .seed-purchase-lines-scroll--packed.seed-purchase-lines-scroll--item-disc {
        --seed-lines-min-width: 1182px;
    }

.seed-purchase-lines-scroll--invoice {
    --seed-lines-min-width: 1086px;
}

.seed-purchase-lines-table table {
    table-layout: fixed;
    width: 100%;
    min-width: var(--seed-lines-min-width, auto);
    border-collapse: collapse;
}

.seed-purchase-lines-table .mud-table-cell {
    vertical-align: middle;
    padding: 4px 6px !important;
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
}

/* Subtle polish: separate the header, and highlight the active row so a
   wide, mostly-empty row doesn't feel visually flat. */
.seed-purchase-lines-table thead .mud-table-cell {
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.seed-purchase-lines-table tbody .mud-table-row:hover {
    background-color: rgba(0, 0, 0, 0.025);
}

.seed-purchase-lines-table .mud-input-control {
    margin-top: 0;
    margin-bottom: 0;
}

.seed-purchase-lines-table .mud-input-control-input-container {
    width: 100%;
    max-width: 100%;
}

.seed-purchase-lines-table .mud-table-cell .mud-input-control,
.seed-purchase-lines-table .mud-table-cell .mud-select {
    width: 100%;
    max-width: 100%;
}

.seed-purchase-col-expiry .mud-picker,
.seed-purchase-col-expiry .mud-picker-input-text,
.seed-invoice-col-expiry .mud-picker,
.seed-invoice-col-expiry .mud-picker-input-text {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* The calendar adornment reserves 12px margin + 14px inner padding by default,
   which leaves too little room for dd/MM/yy in a compact line cell. */
.seed-purchase-lines-table .mud-input-adornment-end {
    margin-right: 2px;
    margin-inline-end: 2px;
}

.seed-purchase-lines-table .mud-input-root-outlined.mud-input-root-adorned-end {
    padding-inline-start: 8px;
}

.seed-purchase-lines-table .mud-table-cell.seed-purchase-col-numeric,
.seed-purchase-lines-table .mud-table-cell.seed-invoice-col-numeric {
    text-align: right;
}

.seed-purchase-lines-table .seed-purchase-col-numeric .mud-input-slot,
.seed-purchase-lines-table .seed-invoice-col-numeric .mud-input-slot {
    text-align: right;
}

/* Item is intentionally left without a width/max-width: it is the flexible
   column that absorbs remaining space. Give it a sane floor so it never
   collapses when the browser tries to lay out the fixed table. */
.seed-purchase-col-item,
.seed-invoice-col-item {
    min-width: 200px;
}

.seed-purchase-col-packsize {
    width: 80px;
    max-width: 80px;
}
/* Widened: the select's dropdown arrow was being clipped at 72px. */
.seed-purchase-col-uom {
    width: 92px;
    max-width: 92px;
}
/* Widened: date text + calendar icon didn't fit in 150px. */
.seed-purchase-col-expiry {
    width: 178px;
    max-width: 178px;
}

.seed-purchase-col-type {
    width: 132px;
    max-width: 132px;
}

.seed-purchase-col-lot {
    width: 110px;
    max-width: 110px;
}

.seed-purchase-col-hsn {
    width: 72px;
    max-width: 72px;
}

.seed-purchase-col-qty {
    width: 88px;
    max-width: 88px;
}

.seed-purchase-col-packs {
    width: 80px;
    max-width: 80px;
}

.seed-purchase-col-price {
    width: 88px;
    max-width: 88px;
}

.seed-purchase-col-disc {
    width: 76px;
    max-width: 76px;
}

.seed-purchase-col-gst {
    width: 108px;
    max-width: 108px;
}

.seed-purchase-col-taxable {
    width: 84px;
    max-width: 84px;
}

.seed-purchase-col-total {
    width: 88px;
    max-width: 88px;
}

.seed-purchase-col-action {
    width: 40px;
    max-width: 40px;
}

.seed-invoice-col-lot {
    width: 150px;
    max-width: 150px;
}
/* Widened to match the purchase-line fix above. */
.seed-invoice-col-expiry {
    width: 178px;
    max-width: 178px;
}

.seed-invoice-col-hsn {
    width: 72px;
    max-width: 72px;
}

.seed-invoice-col-qty {
    width: 88px;
    max-width: 88px;
}

.seed-invoice-col-pack {
    width: 88px;
    max-width: 88px;
}

.seed-invoice-col-price {
    width: 88px;
    max-width: 88px;
}

.seed-invoice-col-gst {
    width: 108px;
    max-width: 108px;
}

.seed-invoice-col-taxable {
    width: 84px;
    max-width: 84px;
}

.seed-invoice-col-total {
    width: 88px;
    max-width: 88px;
}

.seed-invoice-col-action {
    width: 40px;
    max-width: 40px;
}

.seed-invoice-col-item .mud-autocomplete,
.seed-invoice-col-item .mud-input-slot {
    max-width: 100%;
}

.seed-invoice-col-item .mud-input-control,
.seed-invoice-col-expiry .mud-input-control,
.seed-invoice-col-lot .mud-select {
    min-width: 0;
}

.seed-invoice-col-item .mud-input-root-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.seed-invoice-expiry-picker {
    width: 100%;
    min-width: 0;
}

.seed-purchase-col-item .mud-autocomplete,
.seed-purchase-col-item .mud-input-slot {
    max-width: 100%;
}

.seed-purchase-col-item .mud-input-control,
.seed-purchase-col-expiry .mud-input-control,
.seed-purchase-col-lot .mud-input-control {
    min-width: 0;
}

.seed-purchase-col-item .mud-input-root-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.seed-purchase-expiry-picker {
    width: 100%;
    min-width: 0;
}

/* Totals now track the table's own 100%-width sizing instead of a hardcoded
   pixel value, so they stay aligned with the line columns at every screen
   size instead of drifting once the table starts stretching. */
.seed-purchase-totals-row {
    display: flex;
    justify-content: flex-end;
    box-sizing: border-box;
    width: 100%;
    min-width: var(--seed-lines-min-width, auto);
    padding-right: 40px;
    margin-top: 8px;
}

.seed-purchase-totals {
    flex: none;
    width: 368px;
    min-width: 368px;
}

    .seed-purchase-totals table {
        table-layout: fixed;
        width: 100%;
    }

    .seed-purchase-totals td {
        padding: 2px 8px;
        font-size: 0.875rem;
    }

        .seed-purchase-totals td:first-child {
            width: 196px;
        }

        .seed-purchase-totals td:last-child {
            width: 172px;
        }

@media print {
    .seed-purchase-print-area,
    .seed-purchase-print-area *,
    .seed-processing-print-area,
    .seed-processing-print-area *,
    .seed-packing-print-area,
    .seed-packing-print-area *,
    .seed-invoice-print-area,
    .seed-invoice-print-area * {
        visibility: visible;
    }

    .seed-purchase-print-area,
    .seed-processing-print-area,
    .seed-packing-print-area,
    .seed-invoice-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

        .seed-purchase-print-area .no-print,
        .seed-purchase-print-area .no-print *,
        .seed-processing-print-area .no-print,
        .seed-processing-print-area .no-print *,
        .seed-packing-print-area .no-print,
        .seed-packing-print-area .no-print *,
        .seed-invoice-print-area .no-print,
        .seed-invoice-print-area .no-print * {
            display: none !important;
            visibility: hidden !important;
        }
}
