/* Match table labels and explanations to the exercise instructions. */
body[data-chapter] #content .working-flow table :is(th, td, caption, p, span, strong, b, em, mark, small, div):not(.katex):not(.katex *):not(.worksheet-table-number) {
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: var(--exercise-answer-size) !important;
  line-height: 1.3 !important;
  letter-spacing: normal !important;
}
/* Tabular accounting figures share the table typeface and body size. */
body[data-chapter] #content .working-flow table .worksheet-table-number {
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 1em !important;
  line-height: inherit !important;
  letter-spacing: normal !important;
  white-space: nowrap;
  font-variant-numeric: lining-nums tabular-nums;
}
/* Allocate columns to their contents instead of the old fixed pixel ratios. */
body[data-chapter] #content .working-flow table {
  table-layout: auto !important;
  width: max-content !important;
  min-width: 0 !important;
  max-width: none !important;
  flex: 0 0 auto !important;
}
body[data-chapter] #content .working-flow table :is(col, th, td) {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
}
body[data-chapter] #content .working-flow .exercise-letter-table { width: 100% !important; }
body[data-chapter] .soda-comparison { width: max-content; min-width: 0; }
body[data-chapter] .comfy-linked-sheet { width: max-content; }
body[data-chapter] .socks-general { width: max-content; }
body[data-chapter] .socks-general-layout { grid-template-columns: max-content 40px 600px; }
body[data-chapter] .socks-cases-layout { grid-template-columns: 270px max-content; }
body[data-chapter] .gentry-layout { grid-template-columns: max-content max-content; }
body[data-chapter] .eagle-layout { grid-template-columns: max-content 580px; }
body[data-chapter] .excertreads-layout { grid-template-columns: max-content 810px; }
body[data-chapter] :is(.pricing-workbench, .makebuy-workbench) { width: max-content; }
/* Explanatory prose wraps without setting the width of a numeric column. */
body[data-chapter] #content .working-flow .socks-difference-row td { white-space: normal !important; }
body[data-chapter] #content .working-flow .socks-difference-row :is(.socks-difference, .socks-break-even-revenue) { max-width: 28ch !important; }
body[data-chapter] #content .working-flow .socks-difference-row p { white-space: normal !important; }
/* Explanations and connecting arrows follow the actual table edge. */
body[data-chapter] .shannon-workbench { width: calc(var(--numeric-table-width, 900px) + 760px); }
body[data-chapter] :is(.shannon-safety, .shannon-leverage) { left: calc(var(--numeric-table-width, 900px) + 70px); }
body[data-chapter] .shannon-decline { left: calc(var(--numeric-table-width, 900px) + 446px); }
body[data-chapter] .toyz-workbench { width: calc(var(--numeric-table-width, 1000px) + 540px); }
body[data-chapter] .toyz-formula { left: calc(var(--numeric-table-width, 1000px) + 44px); }
body[data-chapter] .excertreads-choice { left: calc(var(--numeric-table-width, 970px) + 80px); }
@media screen and (max-width: 700px) {
  body[data-chapter] #content .working-flow .exercise-letter-table { width: max-content !important; }
  body[data-chapter] #content .working-flow table th:not([colspan]) {
    max-width: 11em !important;
    white-space: normal !important;
    overflow-wrap: normal !important;
  }
  body[data-chapter] :is(.socks-ratio-arrow, .socks-model-arrow) { display: none !important; }
}

/* The two answers below the Socks comparison use clear, separate reading lines. */
body[data-chapter="3"] #content .working-flow .socks-difference-row .socks-break-even-revenue {
  width: max-content !important;
  max-width: none !important;
  padding: 15px 12px 16px;
}
body[data-chapter="3"] #content .working-flow .socks-difference-row .socks-difference {
  width: 44ch !important;
  min-width: max-content;
  max-width: none !important;
  padding: 15px 18px 18px;
  background: #f5f8f3;
}
body[data-chapter="3"] #content .working-flow .socks-difference-row section > b {
  white-space: nowrap !important;
  margin-bottom: 12px;
}
body[data-chapter="3"] #content .working-flow .socks-difference-explanation {
  max-width: 44ch !important;
  white-space: normal !important;
  line-height: 1.5 !important;
  margin: 10px 0 0;
}
body[data-chapter="3"] #content .working-flow .socks-difference-result {
  margin: 14px 0 12px;
  color: #294638;
}
/* Derive the maximum supplier price directly below the relevant-cost comparison. */
body[data-chapter="4"] .techsystems-maximum {
  display: grid;
  align-items: start;
  gap: 10px;
  margin-left: var(--maximum-note-left, 751px);
}
body[data-chapter="4"] .techsystems-maximum-steps {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 18px;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
}
body[data-chapter="4"] .techsystems-maximum-steps > * { flex: 0 0 auto; }
body[data-chapter="4"] .decision-progress-arrow { color: #518469; }
body[data-chapter="4"] .techsystems-maximum .decision-equation {
  display: block;
  white-space: nowrap !important;
}

/* Parentheses denote deductions without changing the underlying amounts. */
.worksheet-deduction{font-family:KaTeX_Main,"Times New Roman",serif;font-weight:400;white-space:nowrap}

/* Intermediate stages: a cool, quiet band; yellow remains the final-answer cue. */
body[data-chapter] #content .working-flow table tr.worksheet-intermediate>*,
body[data-chapter] #content .working-flow table .worksheet-intermediate-cell{
 background:#eef3f6!important;
 box-shadow:inset 0 1px 0 #bccbd5;
}
body[data-chapter] #content .working-flow table :is(.worksheet-intermediate,.worksheet-intermediate-cell) :is(mark,.answer-highlight,.working-result){
 background:transparent!important;box-shadow:none!important;
}
@media print{
 body[data-chapter] #content .working-flow table tr.worksheet-intermediate>*{border-top:1px solid #93a5b2!important;print-color-adjust:exact}
}

/* Consolidated columns: a pale sage band and a continuous vertical separator. */
body[data-chapter] #content .working-flow table .worksheet-summary-column{
 background:#f1f4ed!important;
 box-shadow:inset 2px 0 0 #a7b49d;
}
body[data-chapter] #content .working-flow table .worksheet-summary-heading{
 background:#dfe7d7!important;color:#34472d!important;text-align:center!important;
 box-shadow:inset 2px 0 0 #8fa180,inset 0 2px 0 #8fa180;
}
/* Preserve both meanings where an intermediate row meets the summary column. */
body[data-chapter] #content .working-flow table tr.worksheet-intermediate>.worksheet-summary-column,
body[data-chapter] #content .working-flow table .worksheet-intermediate-cell.worksheet-summary-column{
 background:#e3ecf1!important;
 box-shadow:inset 2px 0 0 #a7b49d,inset 0 1px 0 #bccbd5;
}
@media print{
 body[data-chapter] #content .working-flow table .worksheet-summary-column{border-left:1px solid #8fa180!important;print-color-adjust:exact}
}

/* Keep scalar values in the accounting typeface; retain KaTeX for actual equations.
   Existing math nodes remain intact so references, accessibility and arrows survive. */
body[data-chapter] #content .working-flow table{font-variant-numeric:lining-nums tabular-nums}
body[data-chapter] #content .working-flow table :is(.worksheet-number,.worksheet-deduction,.accounting-scalar),
body[data-chapter] #content .working-flow table .accounting-scalar .katex-html,
body[data-chapter] #content .working-flow table .accounting-scalar .katex-html span{
 font-family:Arial,Helvetica,sans-serif!important;font-variant-numeric:lining-nums tabular-nums!important;
 font-style:normal!important;font-size:1em!important;letter-spacing:normal!important;
}
body[data-chapter] #content .working-flow table .accounting-number-cell,
body[data-chapter] #content .working-flow table .accounting-number-cell>.advanced-table-copy{text-align:right!important}
