/* ============================================================
   Designed screens: supplier scorecard and spend / B-BBEE.
   Static, made-up figures. Bar widths come from data-w below
   (inline styles are blocked by the site's security policy).
   ============================================================ */

[data-w="20"] { --w: 20%; }  [data-w="30"] { --w: 30%; }  [data-w="40"] { --w: 40%; }
[data-w="60"] { --w: 60%; }  [data-w="77"] { --w: 77%; }  [data-w="89"] { --w: 89%; }
[data-w="90"] { --w: 90%; }  [data-w="91"] { --w: 91%; }  [data-w="92"] { --w: 92%; }
[data-w="98"] { --w: 98%; }  [data-w="99"] { --w: 99%; }  [data-w="100"] { --w: 100%; }

/* a design screen: white card, grows with its content */
.screen {
  display: block; margin: 0;
  padding: 16px; background: var(--white);
  font-size: .86rem;
}
.scr-head { padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.scr-title { font-family: var(--serif); font-weight: 600; color: var(--ink); font-size: 1rem; }
.scr-sub { color: var(--muted); font-size: .78rem; }
.scr-foot { margin-top: 10px; color: var(--muted); font-size: .74rem; line-height: 1.4; }

/* ---------- scorecard ---------- */
.sc { width: 100%; border-collapse: collapse; margin-top: 4px; }
.sc thead th { font-size: .72rem; font-weight: 500; color: var(--muted); text-align: left; padding: 8px 0 6px; }
.sc th.num, .sc td.num { text-align: right; }
.sc tbody th, .sc tbody td { padding: 10px 0; border-top: 1px solid var(--rule); vertical-align: top; }
.sc tbody th { font-weight: 400; text-align: left; padding-right: 10px; }
.sc td.num { padding-right: 10px; width: 3.6rem; }
.sc td:last-child { width: 1%; white-space: nowrap; }
.sc thead th:last-child, .sc td:last-child { padding-left: 12px; }

.sc-name { display: block; color: var(--ink); font-weight: 500; line-height: 1.3; }
.sc-parts { display: block; color: var(--muted); font-size: .74rem; line-height: 1.35; margin-top: 2px; }
.sc-note { display: block; color: var(--orange-ink); font-size: .74rem; line-height: 1.35; margin-top: 2px; }
.sc-score { display: block; font-family: var(--serif); font-weight: 600; font-size: 1.05rem; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.sc-bar { display: block; height: 4px; background: var(--rule); margin-top: 5px; border-radius: 2px; overflow: hidden; }
.sc-bar > span { display: block; height: 100%; width: var(--w, 0); background: var(--ink); border-radius: 0 2px 2px 0; }

/* status: icon + word, never colour alone */
.st { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 2px; font-size: .72rem; font-weight: 500; line-height: 1.4; }
.st > span { font-weight: 600; }
.st-ok { color: var(--ink); background: var(--stone); }
.st-watch { color: var(--orange-ink); border: 1.5px solid var(--orange); padding: 1px 6px; }
.st-act { color: #fff; background: var(--orange); }

/* on the narrowest phones the status drops under the supplier name */
@media (max-width: 400px) {
  .sc thead { display: none; }
  .sc tbody tr:first-child { border-top: 0; }
  .sc tbody tr { display: grid; grid-template-columns: 1fr auto; border-top: 1px solid var(--rule); padding: 10px 0; }
  .sc tbody th, .sc tbody td { border-top: 0; padding: 0; }
  .sc td:last-child { grid-column: 1 / -1; margin-top: 6px; width: auto; }
  .sc td.num { padding-right: 0; padding-left: 10px; }
}

/* ---------- spend and B-BBEE ---------- */
.bb-budget { margin-top: 12px; }
.bb-budget-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bb-big { font-family: var(--serif); font-weight: 600; font-size: 1.6rem; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.bb-of { color: var(--muted); font-size: .82rem; }
.bb-meter { height: 8px; background: var(--rule); margin-top: 10px; border-radius: 2px; overflow: hidden; }
.bb-meter > span { display: block; height: 100%; width: var(--w, 0); background: var(--ink); border-radius: 0 2px 2px 0; }
.bb-meter-legend { display: flex; justify-content: space-between; margin-top: 5px; font-size: .74rem; color: var(--muted); }

.bb-label { margin-top: 16px; font-size: .78rem; font-weight: 500; color: var(--text); }
.bb-levels { margin: 6px 0 0; display: grid; gap: 7px; }
.bb-levels > div { display: grid; grid-template-columns: 6.4rem 1fr; gap: 10px; align-items: center; }
.bb-levels dt { font-size: .78rem; color: var(--text); white-space: nowrap; }
/* every bar shares one track width, so lengths compare honestly (Level 1 = full track) */
.bb-levels dd { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) 5.6rem; align-items: center; gap: 8px; min-width: 0; }
.bb-bar { justify-self: start; display: block; height: 10px; width: var(--w, 0); background: var(--orange); border-radius: 0 2px 2px 0; }
/* phones: level name sits above its bar so the bar gets the full width */
@media (max-width: 480px) {
  .bb-levels { gap: 9px; }
  .bb-levels > div { grid-template-columns: 1fr; gap: 3px; }
}
.bb-flag .bb-bar {
  background: repeating-linear-gradient(135deg, var(--orange) 0 3px, var(--paper) 3px 5px);
  box-shadow: inset 0 0 0 1px var(--orange);
}
.bb-flag dt { color: var(--orange-ink); font-weight: 500; }
.bb-val { font-size: .74rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.bb-target { margin-top: 14px; padding: 10px 12px; background: var(--stone); border-left: 3px solid var(--orange); font-size: .8rem; line-height: 1.45; }
.bb-target strong { color: var(--ink); font-weight: 600; }
