/* Shared page styling: parts_list_preview.css. */
/* ---- Costing table: page-specific layer on top of static/css/sx-table.css ---- */
.costing-preview .costing-table-container.sx-scroll {
    border: 0; border-radius: 0;
    max-height: calc(100vh - 335px); min-height: 220px;
}
.costing-preview .costing-table.sx-table { min-width: 1300px; table-layout: auto; }
/* One small brand detail anchors the header; no vertical header separators. */
.costing-preview .sx-table > thead > tr > th:nth-child(2) { color: var(--cp-green) !important; }
.costing-preview .sx-table > thead > tr > th:nth-child(2)::before {
    content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 7px;
    border-radius: 50%; background: #5ebc67; vertical-align: 2px;
}

/* Column map (order fixed by base template + nth-child hooks in business JS):
   1 #  2 Part  3 Req  4 Chosen  5 Supplier  6 Cost  7 Cur  8 Lead
   9 Total  10 Quotes  11 Status  12 Stock  13 Notes  14 Actions */
.costing-preview .sx-table :is(th, td):nth-child(1) { width: 64px; min-width: 64px; left: 0; }
.costing-preview .sx-table :is(th, td):nth-child(2) { min-width: 190px; left: var(--cx-pin-2, 64px); }
.costing-preview .sx-table :is(th, td):is(:nth-child(3), :nth-child(4), :nth-child(6), :nth-child(8), :nth-child(9)) { text-align: right; }
.costing-preview .sx-table :is(th, td):nth-child(5) { min-width: 250px; }
.costing-preview .sx-table :is(th, td):nth-child(13) { width: 54px; min-width: 54px; text-align: center; }
.costing-preview .sx-table :is(th, td):nth-child(14) { width: 1%; padding-left: 8px !important; padding-right: 10px !important; }
.costing-preview .sx-table :is(th, td):nth-child(14) { text-align: right; }

/* Identity columns */
.costing-preview .sx-table > tbody > tr > td:nth-child(1) {
    color: var(--sx-muted); font-size: 14px; font-weight: 500; white-space: nowrap;
}
.costing-preview .sx-table > tbody > tr.group-line-parent > td:nth-child(1) { color: var(--sx-ink); font-weight: 600; }
.costing-preview .sx-table > tbody > tr > td:nth-child(2) strong {
    color: var(--sx-ink); font-weight: 600; letter-spacing: 0.005em; white-space: nowrap;
}
.costing-preview .sx-table > tbody > tr > td:nth-child(2) .d-flex { gap: 2px !important; }
.costing-preview .sx-table > tbody > tr > td:nth-child(2) .mt-1 { margin-top: 2px !important; }
.costing-preview .sx-table .copy-part-number-btn { min-width: 32px; height: 32px; }
.costing-preview .sx-table .copy-part-number-btn i { font-size: 15px; }

/* Requested qty reads as plain number, not a chip (badge kept for JS hooks). */
.costing-preview .sx-table .badge[data-requested-qty] {
    background: transparent !important; padding: 0 !important; color: var(--sx-muted) !important;
    font: 400 15px/1.45 Inter, system-ui, sans-serif !important;
}
.costing-preview .sx-table .chosen-qty-input { width: 84px; margin-left: auto; font-weight: 500; }
.costing-preview .sx-table .cost-input { width: 110px; margin-left: auto; font-weight: 500; }
.costing-preview .sx-table .lead-days-input { width: 76px; margin-left: auto; }
.costing-preview .sx-table .currency-select { width: 88px; }
.costing-preview .sx-table .notes-input,
.costing-preview .sx-table .notes-input + small[hidden] { display: none !important; }
.costing-preview .sx-table .cx-notes-btn.has-notes {
    color: var(--cp-green) !important; background: #edf6ef !important;
}
.costing-preview .sx-table .cx-notes-btn:is(:hover, :focus-visible) {
    color: var(--cp-green) !important; background: #e2f0e5 !important;
}
.costing-preview .cx-notes-modal .modal-content { border: 0; border-radius: 14px; }
.costing-preview .cx-notes-modal .modal-title { font-size: 18px; font-weight: 600; }
.costing-preview .cx-notes-modal .modal-header,
.costing-preview .cx-notes-modal .modal-footer { border-color: #eaecf0; }
.costing-preview .cx-notes-modal textarea { font-size: 16px; resize: vertical; }
.costing-preview .cx-notes-modal .cx-notes-cancel { background: #f2f4f7; color: #475467; }
.costing-preview .cx-quote-notes { padding: 12px; background: #f9fafb; border-radius: 8px; }
.costing-preview .cx-quote-notes h6 { font-size: 14px; color: #667085; }
.costing-preview .cx-quote-notes p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
/* The inline "qty differs" highlight from the base template stays visible. */
.costing-preview .sx-table .chosen-qty-input[style*="background-color"] { border-color: #f5cf7a !important; }
.costing-preview .sx-table .line-total { font-weight: 600; color: var(--sx-ink); white-space: nowrap; font-size: 15px; }

/* Header sort button matches other headers (overrides the toolbar .btn rule). */
.costing-preview .sx-table > thead #sort-quotes-recent-btn {
    padding: 0 !important; border: 0; background: transparent;
    font: 600 13px/1.4 Inter, system-ui, sans-serif !important;
    letter-spacing: 0.04em; text-transform: uppercase !important; color: var(--sx-muted) !important;
}
.costing-preview .sx-table > thead #sort-quotes-recent-btn:hover { color: var(--sx-ink) !important; }
/* The base template's CSS tooltip escapes the cell; the native title is enough. */
.costing-preview .sx-table .view-quotes-btn[title]:hover::after { content: none; display: none; }
/* Notes are optional: no "to do" well, and the placeholder only on hover/focus. */
.costing-preview .sx-table .notes-input:placeholder-shown { background-color: transparent; }
.costing-preview .sx-table .notes-input::placeholder { color: transparent; }
.costing-preview .sx-table > tbody > tr:is(:hover, :focus-within) .notes-input::placeholder { color: var(--sx-faint); }

/* Supplier: one line. [Select2 ........][src pill][emailed picker icon] */
.costing-preview .cx-supplier { display: flex; align-items: center; gap: 4px; min-width: 0; }
.costing-preview .cx-supplier > .select2-container { flex: 1 1 auto; width: auto !important; min-width: 0; }
.costing-preview .cx-supplier > .supplier-source-badge { flex: none; order: 2; }
.costing-preview .cx-supplier > .supplier-source-badge.d-none { display: none !important; }
/* Emailed-suppliers <select> becomes a 28px icon trigger. The native select
   keeps full keyboard + listener behaviour; only its face is restyled. */
.costing-preview .sx-table .cx-supplier > .emailed-supplier-line-select {
    order: 3; flex: none;
    width: 34px !important; height: 34px; min-height: 34px !important;
    padding: 0 !important; color: transparent !important; cursor: pointer;
    border-color: transparent !important;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2398a2b3' viewBox='0 0 16 16'%3E%3Cpath d='M2 2a2 2 0 0 0-2 2v8.01A2 2 0 0 0 2 14h5.5a.5.5 0 0 0 0-1H2a1 1 0 0 1-.966-.741l5.64-3.471L8 9.583l7-4.2V8.5a.5.5 0 0 0 1 0V4a2 2 0 0 0-2-2zm3.708 6.208L1 11.105V5.383zM1 4.217V4a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v.217l-7 4.2z'/%3E%3Cpath d='M14.247 14.269c1.01 0 1.587-.857 1.587-2.025v-.21C15.834 10.43 14.64 9 12.52 9h-.035C10.42 9 9 10.36 9 12.432v.214C9 14.82 10.438 16 12.358 16h.044c.594 0 1.018-.074 1.237-.175v-.73c-.245.11-.673.18-1.18.18h-.044c-1.334 0-2.571-.788-2.571-2.655v-.157c0-1.657 1.058-2.724 2.64-2.724h.04c1.535 0 2.484 1.05 2.484 2.326v.118c0 .975-.324 1.39-.639 1.39-.232 0-.41-.148-.41-.42v-2.19h-.906v.569h-.03c-.084-.298-.368-.63-.954-.63-.778 0-1.259.555-1.259 1.4v.528c0 .892.49 1.434 1.26 1.434.471 0 .896-.227 1.014-.643h.043c.118.42.617.648 1.12.648m-2.453-1.588v-.227c0-.546.227-.791.573-.791.297 0 .572.192.572.708v.367c0 .573-.253.744-.564.744-.354 0-.581-.215-.581-.8Z'/%3E%3C/svg%3E") center / 18px no-repeat !important;
}
.costing-preview .sx-table .cx-supplier > .emailed-supplier-line-select:hover,
.costing-preview .sx-table .cx-supplier > .emailed-supplier-line-select:focus {
    background-color: #e9eef5 !important; border-color: transparent !important;
}
.costing-preview .sx-table .cx-supplier > .emailed-supplier-line-select option { color: var(--sx-ink); }
/* Select2's dropdown is parented to the scroller; keep it above sticky cells. */
.costing-preview .costing-table-container .select2-dropdown { z-index: 20; border-color: var(--sx-line-strong); border-radius: 8px; box-shadow: 0 12px 32px rgba(16, 24, 40, 0.12); font-size: 15px; }

/* Quotes: icon + count chip + age, kept on one line. */
.costing-preview .sx-table > tbody > tr > td:nth-child(10) > .d-inline-flex { gap: 4px !important; flex-wrap: nowrap; }
.costing-preview .sx-table .view-quotes-btn .quote-badge { margin-left: 2px !important; }
.costing-preview .sx-table .view-quotes-btn .quote-badge .badge { padding: 0 6px !important; font-size: 13px !important; line-height: 16px !important; }
/* Business JS swaps btn-success / btn-outline-warning to signal quote state;
   translate that into a quiet tinted icon instead of a filled button. */
.costing-preview .sx-table .view-quotes-btn.btn-success { color: var(--control-ink) !important; background: #ecfdf3 !important; }
.costing-preview .sx-table .view-quotes-btn.btn-outline-warning { color: #916127 !important; background: #fbf2e6 !important; }
.costing-preview .sx-table .latest-quote-age-badge { background: transparent !important; color: var(--sx-muted) !important; padding: 0 2px !important; font-weight: 400 !important; }

/* Stock: count pill + use-stock icon. */
.costing-preview .sx-table > tbody > tr > td:nth-child(12) > .d-flex { gap: 2px !important; }
.costing-preview .sx-table > tbody > tr > td:nth-child(12) > .text-muted { color: var(--sx-faint) !important; }

/* Actions: [Save][Workspace][...] — Save surfaces on hover, or as a labelled
   amber control whenever the row has unsaved changes. */
.costing-preview .sx-table .action-buttons { gap: 0 !important; justify-content: flex-end; }
.costing-preview .sx-table .cx-save.btn-warning,
.costing-preview .sx-table > tbody > tr.row-modified .cx-save {
    opacity: 1; color: #93370d !important; background: #fef0c7 !important; padding: 0 8px !important;
}
.costing-preview .sx-table > tbody > tr.row-modified .cx-save:hover { background: #fedf89 !important; }
.costing-preview .sx-table .cx-save .bi-exclamation-circle { font-size: 15px; }
.costing-preview .sx-table .cx-save .bi-exclamation-circle.me-1 { margin-right: 4px !important; }
.costing-preview :is(a, button, input, select, textarea):focus-visible { outline: 2px solid #547eae; outline-offset: 3px; }
@media (max-width: 1200px) {
    .costing-preview .preview-header > .card-header { padding-left: 0 !important; }
    .costing-preview .preview-nav-row { gap: 10px; }
    .costing-preview .preview-heading .card-title { font-size: 26px !important; }
    .costing-preview .preview-actions { flex-wrap: wrap; }
}
@media (max-width: 700px) {
    .costing-preview .preview-heading { align-items: flex-start; flex-wrap: wrap; gap: 16px; }
    .costing-preview .preview-tabs { gap: 20px; flex-wrap: wrap; }
    .costing-preview .preview-costing > .card-header { padding: 12px !important; }
    .costing-preview .preview-filters .btn { padding: 7px 8px !important; }
    .costing-preview .costing-table-container { max-height: 65vh; }
}
