/* The extension uses the Savings Manager's existing Storefronts layout, scoped away from the host page. */
.calculator-savings-host {
    --pf-border: #e9ebec;
    --pf-surface: #fff;
    --pf-surface-soft: #f8f9fa;
    --pf-text: #495057;
    --pf-muted: #74788d;
    --pf-faint: #74788d;
    --pf-accent: #556ee6;
    --pf-accent-soft: rgba(85, 110, 230, .08);
}
body.dark .calculator-savings-host,
[data-bs-theme="dark"] .calculator-savings-host,
[data-layout-mode="dark"] .calculator-savings-host {
    --pf-border: #32394e;
    --pf-surface: #2a3042;
    --pf-surface-soft: #222736;
    --pf-text: #e9ecef;
    --pf-muted: #b6bdd0;
    --pf-faint: #b6bdd0;
}
.calculator-savings-host .modal-content { background: var(--pf-surface); color: var(--pf-text); }
.calculator-savings-host .modal-header, .calculator-savings-host .modal-footer { border-color: var(--pf-border); }
.calculator-savings-host .text-muted { color: var(--pf-muted) !important; }
.calculator-savings-host .form-control, .calculator-savings-host .form-select { background-color: var(--pf-surface); color: var(--pf-text); border-color: var(--pf-border); }
.calculator-savings-host .modal-xl { max-width: min(1140px, calc(100vw - 24px)); }
.calculator-savings-host .modal-fullheight .modal-content { max-height: calc(100vh - 48px); }
.calculator-savings-host .modal-fullheight .modal-body { overflow: auto; }
.calculator-savings-host .lead-product-finder-modal-title-wrap { display: flex; align-items: center; gap: .75rem; }
.calculator-savings-host .lead-product-finder-modal-icon { color: var(--pf-accent); font-size: 22px; }
.calculator-savings-host .tracked-storefronts { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: min(660px, calc(100vh - 240px)); min-height: 250px; }
.calculator-savings-host .tracked-storefronts-rail, .calculator-savings-host .tracked-storefronts-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.calculator-savings-host .tracked-storefronts-rail { border-right: 1px solid var(--pf-border); background: var(--pf-surface-soft); }
.calculator-savings-host .tracked-storefronts-main { background: var(--pf-surface); }
.calculator-savings-host .tracked-storefronts-rail-head, .calculator-savings-host .tracked-storefront-detail-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex: 0 0 auto; min-height: 68px; padding: .85rem 1rem; border-bottom: 1px solid var(--pf-border); }
.calculator-savings-host .tracked-storefront-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.calculator-savings-host .tracked-storefront-list-item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: .65rem; padding: .82rem 1rem; border: 0; border-bottom: 1px solid var(--pf-border); background: transparent; color: var(--pf-text); cursor: pointer; text-align: left; }
.calculator-savings-host .tracked-storefront-list-item:hover, .calculator-savings-host .tracked-storefront-list-item:focus, .calculator-savings-host .tracked-storefront-list-item.active { background: var(--pf-accent-soft); }
.calculator-savings-host .tracked-storefront-list-item.active { box-shadow: inset 3px 0 0 var(--pf-accent); }
.calculator-savings-host .tracked-storefront-list-main { flex: 1 1 auto; min-width: 0; }
.calculator-savings-host .tracked-storefront-list-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.calculator-savings-host .tracked-storefront-list-meta { display: flex; gap: .3rem; margin-top: .25rem; color: var(--pf-muted); font-size: .75rem; }
.calculator-savings-host .tracked-storefront-overview-card { height: auto; min-height: 88px; padding: .9rem 1rem; border: 1px solid var(--pf-border); border-radius: 10px; background: var(--pf-surface); }
.calculator-savings-host .tracked-storefront-empty-rail { padding: 2.5rem 1.25rem; color: var(--pf-muted); text-align: center; }
.calculator-savings-host .tracked-storefront-empty-rail i, .calculator-savings-host .tracked-storefront-empty-rail small { display: block; margin-bottom: .6rem; }
.calculator-savings-host [hidden] { display: none !important; }
.calculator-savings-host .dropdown-menu { background: var(--pf-surface); color: var(--pf-text); }
.calculator-savings-host .dropdown-item { color: var(--pf-text); }
/* The extension's scoped Bootstrap lacks some typography rules the site theme provides. */
.calculator-savings-host.mercury3PWrap { font-size: 13px; line-height: 1.5; }
.calculator-savings-host.mercury3PWrap .modal-title { font-size: 16px; font-weight: 600; line-height: 1.3; margin: 0; }
.calculator-savings-host.mercury3PWrap h6 { margin-top: 0; font-size: 14px; font-weight: 600; line-height: 1.3; }
.calculator-savings-host.mercury3PWrap .small, .calculator-savings-host.mercury3PWrap small { font-size: 85%; }
.calculator-savings-host.mercury3PWrap .fw-semibold { font-weight: 600 !important; }
.calculator-savings-host.mercury3PWrap p { margin: 0 0 1rem; }
.calculator-savings-host.mercury3PWrap .form-label { display: inline-block; margin-bottom: .35rem; font-size: 13px; font-weight: 600; }
.calculator-savings-host.mercury3PWrap .form-control, .calculator-savings-host.mercury3PWrap .form-select, .calculator-savings-host.mercury3PWrap .form-check-label { font-size: 13px; }

/* Apply Deals: a short form, so a compact centered dialog. */
.calculator-deals-dialog { max-width: 460px; }
#CalculatorDealsModal .modal-title { display: flex; align-items: center; gap: .5rem; font-size: 16px; font-weight: 600; line-height: 1.3; }
#CalculatorDealsModal .modal-title i { color: var(--pf-accent, #556ee6); font-size: 15px; }
#CalculatorDealsModal .modal-body { font-size: 13px; line-height: 1.5; }
.calculator-deals-intro { margin: 0 0 1rem; color: var(--pf-muted, #74788d); font-size: 13px; }
.calculator-deals-field + .calculator-deals-field { margin-top: .9rem; }
.calculator-deals-field .form-label { display: block; margin-bottom: .35rem; font-size: 13px; font-weight: 600; }
.calculator-deals-optional { margin-left: .2rem; color: var(--pf-muted, #74788d); font-size: 12px; font-weight: 400; }
#CalculatorDealsModal .form-control { height: 36px; padding: .375rem .75rem; font-size: 13px; }
#CalculatorDealsModal .form-control::placeholder { color: var(--pf-faint, #74788d); opacity: .6; }
#CalculatorDealsModal .select2-container .select2-selection--single { height: 36px; border-color: var(--pf-border, #ced4da); background: var(--pf-surface, #fff); }
#CalculatorDealsModal .select2-container .select2-selection--single .select2-selection__rendered { padding-left: .75rem; color: var(--pf-text, #495057); font-size: 13px; line-height: 34px; }
#CalculatorDealsModal .select2-container .select2-selection--single .select2-selection__placeholder { color: var(--pf-faint, #74788d); opacity: .75; }
#CalculatorDealsModal .select2-container .select2-selection--single .select2-selection__arrow { height: 34px; }
.calculator-deals-quantity { max-width: 140px; }
.calculator-deals-help { margin-top: .35rem; color: var(--pf-muted, #74788d); font-size: 12px; line-height: 1.4; }
.calculator-deals-applied { display: flex; gap: .6rem; align-items: flex-start; margin: 0 0 1rem; padding: .65rem .8rem; border: 1px solid rgba(52, 195, 143, .35); border-radius: 8px; background: rgba(52, 195, 143, .08); font-size: 12.5px; }
.calculator-deals-applied i { margin-top: 2px; color: #34c38f; }
.calculator-deals-applied strong { display: block; font-weight: 600; }
.calculator-deals-applied span { color: var(--pf-muted, #74788d); }
.calculator-deals-applied.is-stale { border-color: rgba(241, 180, 76, .5); background: rgba(241, 180, 76, .1); }
.calculator-deals-applied.is-stale i { color: #f1b44c; }
#CalculatorDealsModal [data-calculator-deal-error] { margin-top: 1rem; padding: .6rem .8rem; font-size: 12.5px; }
#CalculatorDealsModal .modal-footer.calculator-deals-footer { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: .5rem; }
#CalculatorDealsModal .calculator-deals-footer > *, #CalculatorDealsModal .calculator-deals-actions .btn { width: auto; margin: 0; }
#CalculatorDealsModal .calculator-deals-manager { padding: .375rem 0; font-size: 13px; text-decoration: none; white-space: nowrap; }
#CalculatorDealsModal .calculator-deals-manager i { margin-right: .25rem; }
.calculator-deals-actions { display: flex; gap: .5rem; margin-left: auto; }

/* Applied deal chips under the calculator's Buy Cost inputs. */
.calculator-savings-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.calculator-deal-chips { display: flex; margin-top: 4px; }
.calculator-deal-chips:empty { display: none; }
.calculator-deal-chip { display: inline-flex; flex-wrap: wrap; align-items: center; column-gap: 5px; max-width: 100%; padding: 2px 8px; border: 1px solid rgba(52, 195, 143, .45); border-radius: 10px; background: rgba(52, 195, 143, .12); color: #17714f; font-family: inherit; font-size: 11px; font-weight: 600; line-height: 16px; text-align: left; cursor: pointer; }
.calculator-deal-chip:hover { background: rgba(52, 195, 143, .2); }
.calculator-deal-chip:focus-visible { outline: 0; box-shadow: 0 0 0 2px rgba(52, 195, 143, .4); }
.calculator-deal-chip i { font-size: 10px; }
.calculator-deal-chip-saving { font-weight: 500; }
.calculator-deal-chip.is-stale { border-color: rgba(241, 180, 76, .6); background: rgba(241, 180, 76, .14); color: #845508; }
.calculator-deal-chip.is-stale:hover { background: rgba(241, 180, 76, .24); }
.calculator-deal-chip.is-fresh { animation: calculator-deal-pop .9s ease-out; }
@keyframes calculator-deal-pop { from { box-shadow: 0 0 0 0 rgba(52, 195, 143, .55); } to { box-shadow: 0 0 0 8px rgba(52, 195, 143, 0); } }
@media (prefers-reduced-motion: reduce) { .calculator-deal-chip.is-fresh { animation: none; } }
body.dark .calculator-deal-chip { background: rgba(52, 195, 143, .16); color: #5fd9ab; }
body.dark .calculator-deal-chip.is-stale { background: rgba(241, 180, 76, .16); color: #f1b44c; }
body.dark .calculator-deals-applied { background: rgba(52, 195, 143, .1); }

/* Lead editor net-cost badges: the extension's bg-* utilities read theme variables it never defines. */
.mercury3PWrap [data-lead-edit-net-cost] { --bs-bg-opacity: 1; --bs-success-rgb: 52, 195, 143; --bs-info-rgb: 80, 165, 241; --bs-warning-rgb: 241, 180, 76; }
.mercury3PWrap [data-lead-edit-net-cost] .badge { padding: 3px 6px; border-radius: 4px; color: #fff; font-size: 10.5px; font-weight: 600; line-height: 1; vertical-align: 1px; }
.mercury3PWrap [data-lead-edit-net-cost] .badge.bg-warning { color: #343a40; }
@media (min-width: 768px) {
    .calculator-savings-host #deal-rule-form.deal-editor-advanced [data-deal-adjustment-row] > .col-6 { width: 33.333333%; }
}
@media (max-width: 767px) {
    .calculator-savings-host .tracked-storefronts { grid-template-columns: minmax(0, 1fr); height: auto; }
    .calculator-savings-host .tracked-storefronts-rail { border-right: 0; border-bottom: 1px solid var(--pf-border); max-height: 230px; }
    .calculator-savings-host .modal-dialog { margin: 12px; }
}

.calculator-deals-info { margin-left: 4px; font-size: .8em; opacity: .65; cursor: help; }
.calculator-deals-info:hover, .calculator-deals-info:focus { opacity: 1; }
