/* Sales pipeline, offers and invoices (modules/40_sales.php, 42_offers.php, 45_invoices.php) */

/* pipeline: stage chips on a lead, kanban columns */
.sx-stages { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.sx-stages .chip { cursor: pointer; background: transparent; font: inherit; font-size: 0.85rem; }
.sx-kanban { grid-auto-columns: minmax(210px, 1fr); } /* the four open stages fit next to the sidebar at 1280 px */
.sx-kanban .kanban-card strong { overflow-wrap: anywhere; }
.sx-kanban .kanban-card.is-late { border-color: rgba(255, 123, 107, 0.45); }
.sx-check { width: 34px; height: 34px; min-height: 34px; flex-shrink: 0; }
.sx-check svg { width: 16px; height: 16px; stroke-width: 3; }
.list-item.is-done strong { text-decoration: line-through; color: var(--muted); }

/* document actions (send / accept / version / invoice …) */
.sx-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

/* offer / invoice editor */
.sx-doc-form { position: relative; }
.sx-default-submit { position: absolute; left: -9999px; top: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.sx-docdisc { max-width: 260px; margin-bottom: 0.8rem; }
.item-row .field input.is-invalid, .sx-docdisc input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.item-row .f-total b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-row textarea { min-height: 44px; resize: vertical; }
.item-row .field input { padding-left: 0.6rem; padding-right: 0.6rem; }
@media (min-width: 900px) {
    /* room for units like "паушал" and for 9-digit prices */
    .item-row { grid-template-columns: minmax(0, 3.4fr) minmax(64px, 0.8fr) minmax(106px, 0.9fr) minmax(104px, 1.2fr) minmax(58px, 0.7fr) minmax(78px, 0.9fr) auto; }
}
.totals { margin-top: 0.9rem; }
.totals .sx-rates { display: grid; gap: 0.35rem; justify-content: stretch; } /* not the space-between of .totals div */
.totals .sx-rates:empty { display: none; }
.totals b, .totals span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sx-savebar {
    position: sticky; bottom: 0; z-index: 4; display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: flex-end;
    margin: 0 -0.25rem 0.6rem; padding: 0.7rem 0.25rem; background: linear-gradient(180deg, transparent, var(--bg) 35%);
}
.sx-issue-help { text-align: right; margin-bottom: 1rem; }
.sx-rate-row { padding-bottom: 0.6rem; margin-bottom: 0.6rem; border-bottom: 1px dashed var(--line); }

/* on phones the tab bar covers the bottom: keep the save bar above it (same offset as .sticky-actions) */
@media (max-width: 959px) {
    .sx-savebar { bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px)); }
    .sx-savebar .btn { flex: 1 1 auto; justify-content: center; }
    .sx-issue-help { text-align: left; }
}
