/* Sales analytics page (boss only). Phone-first; categorical slots validated for the light surface. */

#tab-sales {
    --sales-ink: var(--classic-text, #1f2937);
    --sales-soft: var(--classic-text-soft, #5f6b7a);
    --sales-faint: var(--classic-text-faint, #94a3b8);
    --sales-line: var(--classic-line, #e2e8f0);
    --sales-panel: var(--classic-surface-muted, #f6f8fb);
    --sales-accent: var(--classic-blue-strong, #1d4ed8);
    --sales-accent-soft: var(--classic-blue-soft, #eaf1ff);
    --sales-up: var(--classic-green-strong, #15803d);
    --sales-down: var(--classic-red-strong, #c0262d);
    --sales-warn-soft: var(--classic-amber-soft, #fdf3e1);
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    min-width: 0;
}

.sales-card { min-width: 0; }
.sales-card .section-title { margin-bottom: 4px; }
.sales-muted { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--sales-soft); }
.sales-note { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--sales-panel); font-size: 13px; color: var(--sales-ink); }
.sales-note-warn { background: var(--sales-warn-soft); }
.sales-sync { margin-top: 8px; }
.sales-hint { font-size: 12px; color: var(--sales-faint); }
.sales-subhead { margin: 16px 0 6px; font-size: 14px; font-weight: 800; color: var(--sales-ink); }
.sales-link { border: 0; background: none; padding: 0; color: var(--sales-accent); font-weight: 700; min-height: 32px; }

/* range and filter chips: one scrollable row on narrow phones */
.sales-chips { display: flex; gap: 6px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.sales-chips::-webkit-scrollbar { display: none; }
.sales-chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--sales-line);
    background: #fff; color: var(--sales-ink); font-size: 14px; font-weight: 600; white-space: nowrap; }
.sales-chip.active { background: var(--sales-accent); border-color: var(--sales-accent); color: #fff; }
.sales-chip:focus-visible, .sales-products button:focus-visible { outline: 2px solid var(--sales-accent); outline-offset: 2px; }
.sales-chips-small { margin-top: 8px; }
.sales-chips-small .sales-chip { min-height: 32px; padding: 0 12px; font-size: 13px; }

/* KPI tiles */
.sales-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sales-kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 14px; background: var(--sales-panel); min-width: 0; }
.sales-kpi-label { font-size: 12px; color: var(--sales-soft); }
.sales-kpi-value { font-size: 22px; font-weight: 800; color: var(--sales-ink); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.sales-kpi-sub { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 12px; color: var(--sales-soft); font-variant-numeric: tabular-nums; }
.sales-delta { font-weight: 700; }
.sales-delta-up { color: var(--sales-up); }
.sales-delta-down { color: var(--sales-down); }
.sales-delta-flat { color: var(--sales-soft); }
.sales-compare { font-size: 12px; }
.sales-kpi-ly { color: var(--sales-faint); }
.sales-table-scroll.sales-outlook { margin-top: 10px; max-height: none; overflow-y: visible; }
.sales-outlook .sales-table td:first-child { white-space: normal; min-width: 7em; }
.sales-outlook-name { display: block; font-weight: 600; color: var(--sales-ink); }
.sales-outlook small { display: block; font-size: 11px; color: var(--sales-faint); }
.sales-outlook small.sales-flag { color: var(--sales-down); }
.sales-outlook td small { display: block; font-size: 11px; color: var(--sales-faint); }
.sales-outlook tr.sales-buy td:last-child b { color: var(--sales-accent); font-size: 15px; }
.sales-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.sales-dates label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--sales-soft); min-width: 0; }
.sales-dates input { -webkit-appearance: none; appearance: none; width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box;
    border: 1px solid var(--sales-line); border-radius: 10px; padding: 0 10px; background: #fff; color: var(--sales-ink); font-size: 16px; }
.sales-samples li { flex-direction: column; align-items: flex-start !important; gap: 2px !important; }
.sales-samples li > span:first-child small { display: block; font-size: 11px; color: var(--sales-faint); }
.sales-samples .sales-row-value { white-space: normal; font-size: 12px; line-height: 1.5; }
.sales-outlook th { line-height: 1.3; vertical-align: bottom; }

/* legend, readout, chart */
.sales-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 8px; font-size: 13px; color: var(--sales-ink); font-variant-numeric: tabular-nums; }
.sales-legend span, .sales-rows li > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.sales-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
i.sales-s1, .sales-swatch.sales-s1 { background: var(--series-1); }
i.sales-s2, .sales-swatch.sales-s2 { background: var(--series-2); }
i.sales-s3, .sales-swatch.sales-s3 { background: var(--series-3); }
.sales-readout { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 8px 12px; border-radius: 12px; background: var(--sales-accent-soft);
    font-size: 13px; color: var(--sales-ink); font-variant-numeric: tabular-nums; }
.sales-readout strong { flex-basis: 100%; font-size: 14px; }
.sales-svg { display: block; max-width: 100%; margin-top: 10px; overflow: visible; }
.sales-grid { stroke: var(--sales-line); stroke-width: 1; }
.sales-axis { font-size: 10px; fill: var(--sales-faint); font-variant-numeric: tabular-nums; }
.sales-svg .sales-s1 { fill: var(--series-1); }
.sales-svg .sales-s2 { fill: var(--series-2); }
.sales-hit { fill: transparent; cursor: pointer; }
.sales-bar.selected .sales-hit { fill: var(--sales-accent-soft); }
.sales-bar:not(.selected) .sales-s1, .sales-bar:not(.selected) .sales-s2 { opacity: .9; }

.sales-table-wrap { margin-top: 8px; }
.sales-table-wrap summary { min-height: 40px; display: flex; align-items: center; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--sales-accent); }
.sales-table-scroll { overflow-x: auto; max-height: 320px; overflow-y: auto; }
.sales-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.sales-table th, .sales-table td { padding: 6px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--sales-line); }
.sales-table th:first-child, .sales-table td:first-child { text-align: left; }
.sales-table th { position: sticky; top: 0; background: #fff; color: var(--sales-soft); font-weight: 600; }

/* weekday columns */
.sales-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 12px; align-items: end; }
.sales-weekday { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.sales-weekday-value { font-size: 10px; color: var(--sales-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sales-weekday-bar { display: flex; align-items: flex-end; width: 100%; max-width: 28px; height: 90px; }
.sales-weekday-bar i { display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--series-1); }
.sales-weekday-label { font-size: 12px; font-weight: 700; color: var(--sales-ink); }

/* channel stack, rows and meters */
.sales-stack { display: flex; gap: 2px; height: 14px; margin: 10px 0 8px; border-radius: 7px; overflow: hidden; }
.sales-stack i { display: block; min-width: 2px; }
.sales-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; color: var(--sales-ink); }
.sales-rows li { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-width: 0; }
.sales-row-value { font-variant-numeric: tabular-nums; color: var(--sales-soft); white-space: nowrap; font-size: 13px; }
.sales-meter-row { display: grid !important; grid-template-columns: minmax(4em, 30%) minmax(0, 1fr) auto; }
.sales-meter-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block !important; }
.sales-meter { display: block; height: 8px; border-radius: 4px; background: var(--sales-panel); overflow: hidden; min-width: 0; }
.sales-meter i { display: block; height: 100%; border-radius: 4px; background: var(--series-1); }
.sales-combos li > span:first-child { display: block; font-size: 13px; overflow-wrap: anywhere; }
.sales-callout { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--sales-panel); font-size: 13px; line-height: 1.6; color: var(--sales-ink); }

/* time slots and product ranking */
.sales-slots { display: grid; gap: 6px; margin: 12px 0 4px; }
.sales-slot { display: grid; grid-template-columns: 3em minmax(0, 1fr) 3.5em; align-items: center; gap: 8px; font-size: 13px; color: var(--sales-soft); }
.sales-slot b { text-align: right; color: var(--sales-ink); font-variant-numeric: tabular-nums; }
.sales-slot.active span:first-child { color: var(--sales-accent); font-weight: 700; }
.sales-products { list-style: none; margin: 12px 0 0; padding: 0; display: grid; }
.sales-products li + li { border-top: 1px solid var(--sales-line); }
.sales-products button { width: 100%; display: grid; grid-template-columns: 1.8em minmax(0, 1fr) auto; grid-template-rows: auto auto;
    gap: 2px 8px; align-items: center; padding: 10px 2px; border: 0; background: none; text-align: left; color: var(--sales-ink); min-height: 52px; }
.sales-products li.active button { background: var(--sales-accent-soft); border-radius: 10px; }
.sales-rank { grid-row: span 2; font-size: 13px; font-weight: 800; color: var(--sales-faint); text-align: center; }
.sales-product-name { display: flex; flex-direction: column; min-width: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.sales-product-name small, .sales-product-qty small { font-size: 12px; font-weight: 400; color: var(--sales-soft); }
.sales-product-qty { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.sales-product-qty b { font-size: 16px; }
.sales-product-meter { grid-column: 2 / -1; height: 6px; }
.sales-more { width: 100%; margin-top: 10px; min-height: 44px; }
.sales-detail { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--sales-panel); }
.sales-detail-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 15px; color: var(--sales-ink); }
.sales-detail-head span { font-size: 13px; color: var(--sales-soft); font-variant-numeric: tabular-nums; }
.sales-detail-head .sales-link { margin-left: auto; }
.sales-detail .sales-meter { background: #fff; }
.sales-detail .sales-meter-row { grid-template-columns: minmax(0, 44%) minmax(0, 1fr) auto; }
.sales-detail .sales-meter-row > span:first-child { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; font-size: 13px; line-height: 1.35; }

@media (max-width: 360px) {
    .sales-kpi-value { font-size: 19px; }
    .sales-weekdays { gap: 3px; }
}

/* 出品配方 editor */
.recipe-search { width: 100%; min-height: 44px; margin-top: 12px; box-sizing: border-box; }
.recipe-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; }
.recipe-list li + li { border-top: 1px solid var(--sales-line); }
.recipe-list button { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 2px 8px;
    align-items: center; padding: 10px 2px; border: 0; background: none; text-align: left; color: var(--sales-ink); min-height: 52px; }
.recipe-name { display: flex; flex-direction: column; min-width: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.recipe-name small { font-size: 12px; font-weight: 400; color: var(--sales-soft); }
.recipe-sold { grid-column: 1; font-size: 12px; color: var(--sales-faint); }
.recipe-chip { grid-row: 1 / span 2; grid-column: 2; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.recipe-green { background: #e3f4ea; color: #17824a; }
.recipe-red { background: #fdecec; color: #c42b2b; }
.recipe-blue { background: var(--sales-accent-soft); color: var(--sales-accent); }
.recipe-gray { background: var(--sales-panel); color: var(--sales-soft); }
.recipe-packs li { display: flex; flex-direction: column; gap: 6px; padding: 10px 2px; }
.recipe-pack { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 14px; color: var(--sales-soft); }
.recipe-pack input { width: 6.5em; min-height: 40px; text-align: right; }
.recipe-pack button { min-height: 40px; padding: 0 12px; }
.recipe-pack select { width: auto; min-height: 40px; }
.recipe-pack-add { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--sales-line); }
.recipe-pack-add > select { width: 100%; min-height: 40px; box-sizing: border-box; }
.recipe-warn .recipe-pack { margin-top: 6px; }
.recipe-line .recipe-pack select { width: auto; min-width: 4.5em; }
.recipe-line .recipe-pack input { width: 6.5em; }
.recipe-settings, .recipe-conds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.recipe-settings label, .recipe-conds label { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 12px; color: var(--sales-soft); }
.recipe-settings select, .recipe-conds select, .recipe-line select { width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box; }
.recipe-check { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 14px; color: var(--sales-ink); }
.recipe-check input { width: 20px; height: 20px; flex: none; }
.recipe-lines { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.recipe-line { padding: 10px; border: 1px solid var(--sales-line); border-radius: 12px; background: #fff; }
.recipe-line-top { display: grid; grid-template-columns: minmax(0, 1fr) 7.5em; gap: 8px; }
.recipe-qty { display: flex; align-items: center; gap: 4px; }
.recipe-qty input { width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box; text-align: right; }
.recipe-qty em { font-style: normal; font-size: 13px; color: var(--sales-soft); flex: none; }
.recipe-line .recipe-conds { margin-top: 8px; }
.recipe-line-foot { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.recipe-line-foot input { flex: 1; min-width: 0; min-height: 36px; font-size: 14px; }
.recipe-del { color: var(--sales-down); flex: none; }
.recipe-warn { margin: 6px 0 0; font-size: 12px; }
.recipe-preview { margin-top: 10px; }
.recipe-cond-summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px;
    font-size: 13px; color: var(--sales-ink); }
.recipe-cond-summary span { padding: 3px 8px; border-radius: 8px; background: var(--sales-panel); }

/* ---------------------------------------------------------------- 营业分析 V2 */
.sales-head { padding-bottom: 12px; }
.sales-head-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-width: 0; }
.sales-head-row .section-title { margin-bottom: 0; }
.sales-head-row .sales-subhead { margin: 0; }
.sales-views, .sales-seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; margin-top: 10px;
    padding: 4px; border-radius: 12px; background: var(--sales-panel); }
.sales-view-btn, .sales-seg-btn { min-height: 38px; padding: 0 6px; border: 0; border-radius: 9px; background: none; color: var(--sales-soft);
    font-size: 14px; font-weight: 700; white-space: nowrap; }
.sales-view-btn.active, .sales-seg-btn.active { background: #fff; color: var(--sales-accent); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.sales-view-btn:focus-visible, .sales-seg-btn:focus-visible, .sales-refresh:focus-visible { outline: 2px solid var(--sales-accent); outline-offset: 2px; }
.sales-seg-small { margin-top: 0; padding: 3px; }
.sales-seg-small .sales-seg-btn { min-height: 34px; font-size: 13px; }

/* today | yesterday: side by side on a phone so both are on the first screen */
.sales-days { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.sales-days > .sales-day:only-child { grid-column: 1 / -1; }
.sales-day { display: flex; flex-direction: column; min-width: 0; padding: 12px !important; margin: 0 !important; }
.sales-day-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.sales-day-label { font-size: 15px; font-weight: 800; color: var(--sales-ink); white-space: nowrap; }
.sales-day-label small { font-size: 12px; font-weight: 600; color: var(--sales-soft); }
.sales-chip-live { flex: none; padding: 1px 7px; border-radius: 999px; background: var(--sales-warn-soft); color: #9a5b00; font-size: 11px; font-weight: 700; }
.sales-day-caption { margin-top: 8px; font-size: 12px; color: var(--sales-soft); }
.sales-day-value { font-size: 24px; font-weight: 800; line-height: 1.15; color: var(--sales-ink); font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em; overflow-wrap: anywhere; }
.sales-na { font-size: 16px; font-weight: 700; color: var(--sales-soft); }
.sales-day-stats { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; font-size: 12px; color: var(--sales-soft); }
.sales-day-stats li { display: flex; justify-content: space-between; gap: 6px; min-width: 0; }
.sales-day-stats b { color: var(--sales-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sales-day-compare { margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: var(--sales-soft); }
.sales-day-warn { margin: 8px 0 0; font-size: 11px; line-height: 1.4; color: var(--sales-down); overflow-wrap: anywhere; }
.sales-day-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px;
    font-size: 11px; color: var(--sales-faint); }
.sales-refresh { flex: none; min-height: 32px; padding: 0 10px; border: 1px solid var(--sales-line); border-radius: 999px; background: #fff;
    color: var(--sales-accent); font-size: 12px; font-weight: 700; }
@media (max-width: 340px) { .sales-days { grid-template-columns: minmax(0, 1fr); } }

/* compact top-N list */
.sales-mini-rank { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; gap: 6px; }
.sales-mini-rank li { display: grid; grid-template-columns: 1.4em minmax(0, 1fr) 30% 2.6em; align-items: center; gap: 8px; font-size: 14px; color: var(--sales-ink); }
.sales-mini-rank .sales-rank { grid-row: auto; }
.sales-mini-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-mini-rank b { text-align: right; font-variant-numeric: tabular-nums; }
.sales-range .sales-chips { margin-top: 0; }
.sales-range .sales-chips-small { margin-top: 8px; }
.sales-sync-card .sales-sync { margin-top: 0; }
.sales-more-analysis summary { cursor: pointer; list-style: none; min-height: 40px; display: flex; align-items: center; margin: 0; color: var(--sales-accent); }
.sales-more-analysis summary::-webkit-details-marker { display: none; }
.sales-embedded { margin-top: 12px; }
#salesAdvancedBody .card { margin: 12px 0 0; padding: 0; border: 0; box-shadow: none; background: none; }
#salesAdvanced > summary { cursor: pointer; margin: 0; min-height: 40px; display: flex; align-items: center; }

/* history */
.sales-hist-head .sales-seg { margin-top: 10px; }
.sales-coverage { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; font-size: 13px; color: var(--sales-ink); font-weight: 600; }
.sales-coverage span:last-child { color: var(--sales-soft); font-weight: 400; }
.sales-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sales-summary > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--sales-panel); min-width: 0; }
.sales-summary span { font-size: 12px; color: var(--sales-soft); }
.sales-summary strong { font-size: 20px; font-weight: 800; color: var(--sales-ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sales-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-top: 12px; }
.sales-search { width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box; border: 1px solid var(--sales-line); border-radius: 10px; padding: 0 10px; }
.sales-list-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; table-layout: fixed; }
.sales-list-table th { padding: 6px 4px; font-size: 12px; font-weight: 600; color: var(--sales-soft); text-align: right; border-bottom: 1px solid var(--sales-line); }
.sales-list-table th:first-child { text-align: left; width: 54%; }
.sales-list-table td { padding: 10px 4px; text-align: right; border-bottom: 1px solid var(--sales-line); color: var(--sales-ink); vertical-align: top; }
.sales-list-table td:first-child { text-align: left; font-weight: 600; overflow-wrap: anywhere; }
.sales-list-table td small { display: block; font-size: 11px; font-weight: 400; color: var(--sales-faint); }
.sales-list-table td small.sales-flag, .sales-mat-name small.sales-flag { color: var(--sales-down); }
.sales-list-row { cursor: pointer; }
.sales-list-row.open td { background: var(--sales-accent-soft); }
.sales-list-detail td { padding: 0 0 10px; text-align: left; border-bottom: 1px solid var(--sales-line); }
.sales-list-detail .sales-detail { margin-top: 6px; }
.sales-issues { margin-top: 10px; font-size: 13px; color: var(--sales-ink); }
.sales-issues summary, .sales-explain summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; font-weight: 700; color: var(--sales-accent); }
.sales-issues ul { margin: 4px 0; padding-left: 18px; line-height: 1.6; }
.sales-explain { margin-top: 8px; }
.sales-mat-list { list-style: none; margin: 8px 0 0; padding: 0; }
.sales-mat-list > li + li { border-top: 1px solid var(--sales-line); }
.sales-mat-row, .sales-source-row, .sales-fc-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center;
    padding: 10px 2px; border: 0; background: none; text-align: left; color: var(--sales-ink); min-height: 48px; }
.sales-mat-list li.open > .sales-mat-row { color: var(--sales-accent); }
.sales-mat-name { display: flex; flex-direction: column; min-width: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.sales-mat-name small { font-size: 11px; font-weight: 400; }
.sales-mat-amount { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sales-mat-amount b { font-size: 15px; }
.sales-mat-amount small { font-size: 11px; color: var(--sales-soft); }
.sales-sources { margin: 0 0 10px; padding: 4px 10px; border-radius: 12px; background: var(--sales-panel); }
.sales-sources > ul, .sales-specs { list-style: none; margin: 0; padding: 0; }
.sales-sources > ul > li + li { border-top: 1px solid var(--sales-line); }
.sales-source-row { min-height: 44px; padding: 8px 0; font-size: 14px; }
.sales-source-row span, .sales-specs li span { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.sales-source-row small, .sales-specs small { font-size: 11px; color: var(--sales-soft); }
.sales-source-row b, .sales-specs b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sales-specs { margin: 0 0 8px 10px; padding-left: 10px; border-left: 2px solid var(--sales-line); }
.sales-specs li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 6px 0; font-size: 13px; color: var(--sales-ink); }
.sales-sources-total { display: flex; justify-content: space-between; padding: 8px 0 6px; border-top: 2px solid var(--sales-line);
    font-size: 14px; font-weight: 700; color: var(--sales-ink); font-variant-numeric: tabular-nums; }

/* forecast */
.sales-fc-form .sales-subhead:first-child { margin-top: 0; }
.sales-fc-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sales-fc-pill { padding: 3px 10px; border-radius: 999px; background: var(--sales-panel); font-size: 12px; font-weight: 700; color: var(--sales-ink); }
.sales-fc-pill.sales-fc-short { background: #fdecec; color: var(--sales-down); }
.sales-fc-pill.sales-fc-restock { background: var(--sales-warn-soft); color: #9a5b00; }
.sales-fc-group-head { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 2px 0; min-height: 44px;
    border: 0; background: none; text-align: left; color: var(--sales-ink); }
.sales-fc-group-head > span:first-child { display: flex; flex-direction: column; min-width: 0; font-size: 15px; }
.sales-fc-group-head small { font-size: 12px; color: var(--sales-soft); font-weight: 400; }
.sales-fc-count { flex: none; font-size: 13px; color: var(--sales-soft); }
.sales-fc-group-short .sales-fc-group-head b { color: var(--sales-down); }
.sales-fc-rows { list-style: none; margin: 4px 0 0; padding: 0; }
.sales-fc-rows > li + li { border-top: 1px solid var(--sales-line); }
.sales-fc-buy { color: var(--sales-accent); }
.sales-fc-detail { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; margin: 0 0 10px; padding: 10px 12px; border-radius: 12px;
    background: var(--sales-panel); font-size: 13px; color: var(--sales-ink); }
.sales-fc-detail dt { color: var(--sales-soft); }
.sales-fc-detail dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.recipe-settings input { width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box; }
.sales-loss-row { border-top: 1px dashed var(--sales-line); color: var(--sales-soft); cursor: default; }
.sales-export-btn { display: flex; align-items: center; justify-content: center; text-decoration: none; box-sizing: border-box; }
.sales-prompt { padding: 10px 12px; border-radius: 10px; background: var(--sales-panel); color: var(--sales-ink); user-select: text; }

/* ---------------------------------------------------------------- 成本毛利 (static/costs.js) */
.costs-older { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--sales-soft); white-space: nowrap; }
.costs-older select { flex: 0 1 auto; width: auto; min-width: 0; min-height: 36px; border: 1px solid var(--sales-line); border-radius: 10px; padding: 0 8px; background: #fff;
    color: var(--sales-ink); font-size: 16px; }
.costs-lines { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--sales-line); }
.costs-lines .costs-total { padding-top: 8px; border-top: 1px solid var(--sales-line); font-weight: 800; }
.costs-lines .costs-total .sales-row-value { color: var(--sales-ink); font-size: 15px; }
.costs-table { max-height: none; overflow-y: visible; }
.costs-table td:first-child { white-space: normal; min-width: 7em; }
.costs-table td small { display: block; font-size: 11px; color: var(--sales-faint); }
.costs-table td small.sales-flag { color: var(--sales-down); }
.costs-table tr.costs-bad td { color: var(--sales-down); white-space: normal; }
.costs-how { margin: 4px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--sales-ink); }
.costs-paste { display: block; width: 100%; box-sizing: border-box; margin-top: 10px; padding: 10px; border: 1px solid var(--sales-line);
    border-radius: 12px; background: #fff; color: var(--sales-ink); font-size: 16px; line-height: 1.5; resize: vertical; }
.costs-actions { display: flex; gap: 8px; margin-top: 10px; }
.costs-actions button { flex: 1; min-height: 44px; }
.costs-actions button:disabled { opacity: .45; cursor: not-allowed; }
.costs-search { display: block; width: 100%; box-sizing: border-box; min-height: 40px; margin-top: 10px; padding: 0 12px;
    border: 1px solid var(--sales-line); border-radius: 10px; background: #fff; color: var(--sales-ink); font-size: 16px; }
.costs-prices { list-style: none; margin: 8px 0 0; padding: 0; }
.costs-prices > li + li { border-top: 1px solid var(--sales-line); }
.costs-price-row { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 52px;
    padding: 8px 2px; border: 0; background: none; text-align: left; color: var(--sales-ink); font-size: 14px; }
.costs-price-row > span:first-child { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.costs-price-row small { font-size: 12px; color: var(--sales-soft); }
.costs-price-row > span:last-child { flex: none; font-variant-numeric: tabular-nums; font-weight: 700; }
.costs-price-row:focus-visible { outline: 2px solid var(--sales-accent); outline-offset: 2px; }
.costs-history { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: var(--sales-panel); }
.costs-history .sales-rows li { align-items: flex-start; }
.costs-history .sales-rows small { display: block; font-size: 11px; color: var(--sales-faint); }
.costs-fixed-rows { display: grid; gap: 8px; margin-top: 10px; }
.costs-fixed-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.costs-fixed-row input, .costs-field input { width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box; padding: 0 10px;
    border: 1px solid var(--sales-line); border-radius: 10px; background: #fff; color: var(--sales-ink); font-size: 16px; }
.costs-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.costs-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 12px; color: var(--sales-soft); }
.costs-field input[type="date"] { -webkit-appearance: none; appearance: none; }
.costs-history .sales-subhead { margin-top: 14px; }
.costs-history .costs-total { padding-top: 6px; border-top: 1px solid var(--sales-line); font-weight: 800; }

/* 商品报废: 算报废 / 不算 as a two-way switch on each stock change */
.costs-seg { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--sales-panel); border: 1px solid var(--sales-line); white-space: nowrap; }
.costs-seg button { min-height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--sales-soft);
    font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.costs-seg button.on { background: var(--sales-accent); color: #fff; }
.costs-seg button.on:last-child { background: var(--sales-soft); }   /* 不算 is grey, 算报废 blue */
.costs-waste-waiting td { background: var(--sales-warn-soft); }
.costs-waste-tag { display: inline-block; margin-top: 3px; padding: 1px 6px; border-radius: 999px; background: var(--sales-warn-soft);
    border: 1px solid #f3c58a; color: #b45309; font-size: 11px; font-weight: 700; }
