body {
    background-color: #f8f9fa;
}
.container {
    margin-top: 40px;
}
.table th, .table td {
    vertical-align: middle;
}
.form-control, .btn {
    min-width: 120px;
}

/* Purchase screen: widen the Mode combo in the grid */
#purchaseTable .item-mode {
    min-width: 0;
    width: 90px;
}

/* Purchase screen: widen Category column */
#purchaseTable td:first-child .category-picker,
#purchaseTable td:first-child .category-search {
    min-width: 260px;
}

/* Purchase screen: tighten some numeric columns */
/* Override global min-width for these inputs inside purchase grid */
#purchaseTable .purity-input,
#purchaseTable .rate-input,
#purchaseTable .charge-rate-input,
#purchaseTable .qty-input,
#purchaseTable .weight-input {
    min-width: 0;
}

/* Slightly tighter Qty and Weight columns */
#purchaseTable .qty-input {
    width: 70px;
}

#purchaseTable .weight-input {
    width: 90px;
}

/* Reduce only these specific fields (keeps other columns natural width) */
#purchaseTable .purity-input {
    width: 90px;
}

#purchaseTable .rate-input {
    width: 115px;
}

#purchaseTable .charge-rate-input {
    width: 90px;
}

/* Compact icon-only buttons (override global min-width on .btn) */
.btn.btn-icon {
    min-width: auto !important;
    width: auto;
    padding: 0.25rem 0.4rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn.btn-icon svg {
    display: block;
}
#msg {
    color: #d9534f;
    font-weight: bold;
}

/* ============================================================
   Sticky action bar (Sales / Purchase entry screens)

   The action buttons live at the top of the page, but the entry forms are long -
   after filling in the last row the user had to scroll all the way back up to press
   Create/Authorize. Pinning the bar keeps those buttons reachable at all times.

   The app top bar is position:fixed, height 48px, z-index 1030, so this sits
   immediately below it at top:48px and just under it in stacking order.
   ============================================================ */
.action-bar-sticky {
    position: sticky;
    top: 48px;
    z-index: 1020;
    background: #f8f9fa;            /* match body, so content scrolls invisibly behind */
    padding: .5rem .75rem;
    margin-left: -.75rem;           /* bleed to the container's padding edges */
    margin-right: -.75rem;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .06);
}

/* On short screens a pinned bar eats too much of the viewport - let it scroll away. */
@media (max-height: 560px) {
    .action-bar-sticky { position: static; box-shadow: none; }
}

@media print {
    .action-bar-sticky { display: none; }
}
