/* Sales-only colour correction. Column positions include checkbox and row number. */
.sales-grid tbody td.profit-cell {
  color: #e60012 !important;
  background-color: #fff5f6 !important;
  border-inline: 1px solid #fecdd3 !important;
  opacity: 1 !important;
}
.sales-grid thead th:nth-child(13) {
  color: #475569 !important;
  background: #f1f5f9 !important;
}
.sales-grid thead th:nth-child(14) {
  color: #be123c !important;
  background: #fff1f2 !important;
}
.sales-grid thead th:nth-child(15) {
  color: #b45309 !important;
  background: #fffbeb !important;
}
.sales-grid tfoot td.total-profit-cell {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border-inline: 1px solid #d1fae5 !important;
}
/* A separate, viewport-fixed summary uses the SAME filtered totals as the footer. */
body:has(.alpha-live-totals) { padding-bottom: 98px; }
.alpha-live-totals {
  position: fixed; bottom: 12px; left: 16px; right: 16px; z-index: 30;
  display: grid; grid-template-columns: 1.3fr repeat(4,1fr); gap: 8px;
  background: #fff; border: 1px solid #dbe4ee; border-radius: 14px;
  padding: 8px; box-shadow: 0 -3px 20px #0f172a12;
  font-family: inherit; color: #334155;
}
.alpha-live-totals > div { min-width: 0; padding: 7px 12px; border-radius: 8px; background: #f8fafc; }
.alpha-live-totals span { display: block; font-size: 11px; font-weight: 600; }
.alpha-live-totals strong { display: block; font-size: 18px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.alpha-live-totals .alpha-total-profit { background: #ecfdf5; color: #047857; }
.alpha-live-totals .alpha-total-debt { background: #fffbeb; color: #b45309; }
body.privacy-mode-active .alpha-total-profit,
body.privacy-mode-active .alpha-total-cost,
body.privacy-mode-active .sales-grid tbody td.profit-cell { filter: blur(6px) !important; user-select: none; }
.dark .sales-grid tbody td.profit-cell { color: #fda4af !important; background: #301923 !important; border-color: #633040 !important; }
.dark .sales-grid thead th:nth-child(13) { color: #cbd5e1 !important; background: #1e293b !important; }
.dark .sales-grid thead th:nth-child(14) { color: #fda4af !important; background: #301923 !important; }
.dark .sales-grid thead th:nth-child(15) { color: #fcd34d !important; background: #302619 !important; }
.dark .alpha-live-totals { background: #0f172a; color: #e2e8f0; border-color: #334155; }
.dark .alpha-live-totals > div { background: #1e293b; }
.dark .alpha-live-totals .alpha-total-profit,
.dark .sales-grid tfoot td.total-profit-cell { background: #14352c !important; color: #6ee7b7 !important; }
.dark .alpha-live-totals .alpha-total-debt { background: #302619; color: #fcd34d; }
@media (max-width: 600px) {
 body:has(.alpha-live-totals) { padding-bottom: 186px; }
 .alpha-live-totals { left: 8px; right: 8px; bottom: 6px; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; }
 .alpha-live-totals > div:first-child { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
 .alpha-live-totals > div { padding: 5px 8px; }
 .alpha-live-totals strong { font-size: 15px; }
}
/* Compact totals strip */
body:has(.alpha-live-totals) { padding-bottom: 64px; }
.alpha-live-totals {
  left: 50%; right: auto; transform: translateX(-50%);
  width: calc(100% - 24px); max-width: 880px;
  bottom: 8px; padding: 4px; gap: 4px; border-radius: 9px;
  grid-template-columns: 1.1fr repeat(4, 1fr);
}
.alpha-live-totals > div {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; padding: 6px 8px; border-radius: 5px;
}
.alpha-live-totals span { font-size: 10px; line-height: 1.3; }
.alpha-live-totals strong { font-size: 12px; line-height: 1.3; white-space: nowrap; }
@media (max-width: 700px) {
  body:has(.alpha-live-totals) { padding-bottom: 114px; }
  .alpha-live-totals { max-width: 480px; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .alpha-live-totals > div:first-child { grid-column: 1 / -1; padding-block: 3px; }
  .alpha-live-totals > div { padding: 4px 7px; }
  .alpha-live-totals strong { font-size: 12px; }
}
