/* Profit flow (S-03): waterfall, marketplace rows, profit bridge, average order receipt. */
.card-head--top { align-items: flex-start; flex-wrap: wrap; }
.fig-cap { min-width: 0; }
figure.card { margin: 0; }
.readout {
  min-height: 42px;
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  font-size: 14px;
  line-height: 21px;
}
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 3px; flex: 0 0 auto; }
.swatch--cogs { background: var(--ink-muted); }
.swatch--fees { background: color-mix(in srgb, var(--ink-muted) 62%, var(--surface-raised)); }
.swatch--ship { background: color-mix(in srgb, var(--ink-muted) 36%, var(--surface-raised)); }
.swatch--vouch { background: repeating-linear-gradient(45deg, var(--ink-muted) 0 2px, transparent 2px 5px); border: 1px solid var(--ink-muted); }
.swatch--profit { background: var(--insights); }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.segmented button {
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 0;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button[aria-pressed="true"] { background: var(--insights-soft); color: var(--insights); }

/* ---- where each peso of sales went */
.card--wf { flex: 2 1 600px; }
.wf-scroll { overflow-x: auto; }
.wf { list-style: none; margin: 0; padding: 0; min-width: 560px; display: flex; gap: var(--space-3); align-items: flex-start; }
.wf-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.wf-plot {
  position: relative;
  display: block;
  width: 100%;
  height: 252px;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  cursor: default;
}
.wf-bar { position: absolute; left: 14%; right: 14%; min-height: 3px; border-radius: 3px; background: var(--ink-muted); }
.wf-bar--total { background: var(--insights); }
.wf-val {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  color: var(--ink);
}
.wf-conn { position: absolute; left: 86%; width: calc(28% + 12px); height: 0; border-top: 1px dashed var(--ink-muted); }
.wf-plot:focus-visible .wf-bar, .wf-row:focus-visible .wf-hbar { outline: 2px solid var(--ink); outline-offset: 1px; }
@media (hover: hover) and (pointer: fine) {
  .wf-plot:hover .wf-bar, .wf-row:hover .wf-hbar { outline: 2px solid var(--ink); outline-offset: 1px; }
}
.wf-label { text-align: center; font-size: 13px; line-height: 18px; }
.wf-label__name { font-weight: 600; }
.wf-label__pct { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-muted); }
.wf-rows { display: none; flex-direction: column; gap: var(--space-1); }
.wf-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: var(--space-1) 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: default;
}
.wf-row__top { display: flex; justify-content: space-between; gap: var(--space-2); font-size: 13px; line-height: 18px; }
.wf-row__name { font-weight: 600; }
.wf-row__top .mono { font-weight: 600; }
.wf-row__track { position: relative; display: block; height: 20px; }
.wf-hbar { position: absolute; top: 3px; height: 14px; min-width: 3px; border-radius: 3px; background: var(--ink-muted); }
.wf-hbar.wf-bar--total { background: var(--insights); }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 21px; }
.data-table th, .data-table td { padding: 10px 0; border-top: 1px solid var(--line); text-align: left; }
.data-table thead th { padding-top: 0; border-top: 0; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); }
.data-table tbody th { font-weight: 600; }
.data-table .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; padding-left: var(--space-3); }
.data-table .strong { font-weight: 600; }
.data-table .muted-cell { color: var(--ink-muted); }

/* ---- marketplace by marketplace */
.card--mps { flex: 1 1 400px; }
.mp-rows { display: flex; flex-direction: column; }
.mp-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 14px var(--space-3);
  border: 1px solid transparent;
  border-bottom-color: var(--line);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}
.mp-row[aria-pressed="true"] { border-color: var(--insights); background: var(--insights-soft); }
.mp-row:active { transform: scale(0.99); }
@media (hover: hover) and (pointer: fine) {
  .mp-row:not([aria-pressed="true"]):hover { background: var(--paper); }
}
.mp-row__top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.mp-row__who { min-width: 0; }
.mp-row__name { display: block; font-size: 15px; line-height: 22px; font-weight: 700; }
.mp-row__sub { display: block; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.mp-row__fig { text-align: right; }
.mp-row__profit { display: block; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 14px; line-height: 20px; font-weight: 600; }
.mp-row__margin { display: block; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.mp-bar { display: flex; gap: 2px; height: 14px; }
.mp-seg { min-width: 2px; border-radius: 2px; }
.mp-row__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.mp-row__foot .spark { width: 55%; margin: 0; }
.mp-row__delta { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 13px; line-height: 18px; font-weight: 600; }

/* ---- why profit changed since August */
.card--bridge { flex: 1.6 1 560px; }
.bridge-sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-sunken); font-size: 14px; line-height: 21px; }
.bridge-sum__arrow { color: var(--ink-muted); display: inline-flex; align-self: center; }
.bridge-sum__change { margin-left: auto; font-size: 15px; font-weight: 600; color: var(--insights); }
.bridge-rows { display: flex; flex-direction: column; }
.bridge-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(160px, 1.6fr) 88px; gap: var(--space-3); align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.bridge-row__label { min-width: 0; }
.bridge-row__name { display: block; font-size: 14px; line-height: 20px; font-weight: 600; }
.bridge-row__note { display: block; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.bridge-track { position: relative; display: block; width: 100%; height: 44px; margin: 0; padding: 0; border: 0; background: transparent; cursor: default; }
.bridge-zero { position: absolute; left: 50%; top: 4px; bottom: 4px; border-left: 1px solid var(--ink); }
.bridge-bar { position: absolute; top: 14px; height: 16px; min-width: 2px; border-radius: 3px; }
.bridge-bar--up { background: var(--insights); }
.bridge-bar--down { background: repeating-linear-gradient(45deg, var(--ink-muted) 0 2px, transparent 2px 5px); border: 1px solid var(--ink-muted); }
.bridge-track:focus-visible .bridge-bar { outline: 2px solid var(--ink); outline-offset: 1px; }
.bridge-row__value { text-align: right; font-size: 13px; line-height: 18px; font-weight: 600; }
.bridge-row__value--down { color: var(--danger); }

/* ---- one average order */
.card--order { flex: 1 1 340px; gap: var(--space-3); }
.receipt {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  line-height: 20px;
}
.receipt__head { text-align: center; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); padding-bottom: var(--space-3); border-bottom: 1px dashed var(--line); }
.receipt__lines { margin: 0; }
.receipt__line { display: flex; justify-content: space-between; gap: var(--space-3); padding: 6px 0; }
.receipt__line dt { font-family: var(--font-sans); font-size: 14px; }
.receipt__line dd { margin: 0; }
.receipt__keep { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); margin-top: 6px; padding-top: var(--space-3); border-top: 1px dashed var(--ink); }
.receipt__keep-label { font-family: var(--font-sans); font-size: 15px; font-weight: 700; }
.receipt__keep-value { font-size: 22px; line-height: 28px; font-weight: 600; color: var(--insights); }
.receipt__pct { text-align: right; font-size: 12px; color: var(--ink-muted); }

/* ---- profit by month */
.card--hist { gap: var(--space-4); }
.hist .wf { min-width: 600px; gap: var(--space-1); }
/* Below 960px the 13 columns would not fit beside the sidebar, so the months list as rows, as on phones. */
@media (max-width: 959px) {
  .hist .wf-scroll { display: none; }
  .hist .wf-rows { display: flex; }
  .hist .tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hist .tile:last-child { grid-column: 1 / -1; }
}
.hist .wf-val, .hist .wf-label { font-size: 12px; }
.hist .wf-bar.hist-past { --bar: color-mix(in srgb, var(--insights) 52%, var(--surface-raised)); }
.hist .wf-hbar.wf-bar--total.hist-past { background: color-mix(in srgb, var(--insights) 52%, var(--surface-raised)); }
.hist-table summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--insights); }
.hist-table .data-table { margin-top: var(--space-2); }

/* ---- phone: one column, in the order of design/Phone.dc.html */
@media (max-width: 599px) {
  .sections > .row { display: contents; }
  :where(.sections > *, .sections > .row > *) { order: 50; }
  .sections > .headline { order: 1; }
  .card--brief { order: 2; }
  .card--ask { order: 3; }
  .card--wf { order: 4; }
  .card--order { order: 5; }
  .card--mps { order: 6; }
  .card--bridge { order: 7; }
  .card--hist { order: 8; }
  .wf-scroll { display: none; }
  .wf-rows { display: flex; }
  .readout { min-height: 40px; padding: var(--space-2) var(--space-3); font-size: 13px; line-height: 19px; }
  .mp-row { padding: 14px var(--space-2); }
  .mp-row__sub, .mp-row__margin, .mp-row__delta { font-size: 12px; line-height: 16px; }
  .mp-bar { height: 12px; }
  .bridge-row { grid-template-columns: minmax(0, 1fr) 76px; }
  .bridge-row__label { grid-column: 1 / -1; }
  .receipt { padding: 14px; }
  .receipt__line dt { font-size: 13px; }
  .receipt__keep-value { font-size: 20px; line-height: 26px; }
}
