/* ═══ TEST BENCH (js/test-bench.js) — spec docs/spec-test-bench.md §4.3 ═══
   Tokens only from base.css, so [data-theme="dark"] needs no rules of its own.
   Calm on purpose: one accent for state (amber = waiting / outside a guide,
   red = refused), everything else neutral. */

#bn-overlay { padding: 0; align-items: stretch; justify-content: stretch; background: var(--bg); }
.bn-shell { width: 100%; height: 100%; display: flex; flex-direction: column; min-width: 0; color: var(--tx); }

/* ── top bar ── */
.bn-top { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 20px;
  background: var(--s); border-bottom: 1px solid var(--bd); min-width: 0; }
.bn-id { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex: 1; overflow: hidden; }
.bn-jobno { font-family: monospace; font-weight: 700; font-size: 17px; color: var(--ac); white-space: nowrap; }
.bn-cust { font-weight: 600; white-space: nowrap; }
.bn-eq { color: var(--tx2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bn-pill { border: 1px solid var(--bd); background: var(--s2); color: var(--tx2); border-radius: 999px; padding: 6px 12px;
  font-family: inherit; font-weight: 600; font-size: 13px; line-height: 1; cursor: pointer; white-space: nowrap; }
.bn-pill-ok   { color: var(--gn); background: var(--gnl); border-color: transparent; }
.bn-pill-warn { color: var(--am); background: var(--aml); border-color: transparent; }
.bn-pill-err  { color: var(--ac); background: var(--acl); border-color: transparent; }
.bn-syncdetail { position: absolute; right: 20px; top: calc(100% + 6px); z-index: 5; width: min(360px, calc(100vw - 32px));
  background: var(--s); border: 1px solid var(--bd); border-radius: var(--r); box-shadow: var(--sh2); padding: 14px;
  display: none; font-size: 13px; }
.bn-syncdetail > div { margin-bottom: 8px; }

/* ── machine + stage tabs ── */
.bn-bars { display: flex; flex-wrap: wrap; gap: 6px 24px; padding: 8px 20px; background: var(--s); border-bottom: 1px solid var(--bd); }
.bn-tabs { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; min-width: 0; }
.bn-stabs { margin-left: auto; }
.bn-tab { border: 1px solid transparent; background: transparent; color: var(--tx2); padding: 7px 12px; border-radius: var(--r2);
  font-family: inherit; font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap; }
.bn-tab:hover { background: var(--bg); color: var(--tx); }
.bn-tab.on { background: var(--bg); color: var(--tx); border-color: var(--bd); font-weight: 600; }
.bn-tab-add { color: var(--tx3); }
.bn-n { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--bd2);
  color: var(--tx2); font-size: 11px; text-align: center; }
.bn-addm input { padding: 6px 10px; border: 1px solid var(--bd); border-radius: var(--r2); background: var(--s); color: var(--tx);
  font: inherit; width: 170px; }

/* ── banners ── */
.bn-banner { padding: 8px 20px; background: var(--aml); color: var(--tx); font-size: 13px; border-bottom: 1px solid var(--bd); }
.bn-banner-err { background: var(--acl); color: var(--ac); font-weight: 600; }

/* ── body ── */
.bn-body { flex: 1; overflow: auto; padding: 18px 20px 40px; min-width: 0; -webkit-overflow-scrolling: touch; }
.bn-loading, .bn-muted { color: var(--tx3); font-size: 13px; }
.bn-err { color: var(--ac); }
.bn-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1100px) {
  .bn-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Many-column tables (no-load, temperature run, a widened vibration card) get
     the full row instead of scrolling sideways inside a half-width card. */
  .bn-card.bn-wide { grid-column: 1 / -1; }
}
.bn-after { margin-top: 16px; }

/* ── empty stage ── */
.bn-empty { max-width: 760px; margin: 24px auto; text-align: center; }
.bn-empty > p { color: var(--tx2); margin-bottom: 18px; }
.bn-empty-acts { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.bn-big { min-width: min(420px, 100%); padding: 14px 20px; font-size: 15px; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.bn-big small { font-size: 12px; font-weight: 400; opacity: .85; }
.bn-link { background: none; border: none; color: var(--bl); font: inherit; font-size: 13px; cursor: pointer; padding: 6px 4px; }
.bn-link:hover { text-decoration: underline; }
.bn-picker, .bn-copy { margin: 16px auto 0; max-width: 760px; background: var(--s); border: 1px solid var(--bd); border-radius: var(--r);
  padding: 14px; text-align: left; }
.bn-picker-hd { font-size: 12px; font-weight: 600; color: var(--tx2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
.bn-pick { margin: 0 6px 6px 0; padding: 8px 12px; border: 1px solid var(--bd); border-radius: var(--r2); background: var(--s2);
  color: var(--tx); font: inherit; font-size: 14px; cursor: pointer; }
.bn-pick:hover { border-color: var(--tx3); }

/* ── card ── */
.bn-card { background: var(--s); border: 1px solid var(--bd); border-radius: var(--r); min-width: 0; position: relative; }
.bn-card-hd { padding: 12px 14px 8px; border-bottom: 1px solid var(--bd2); }
.bn-card-top { display: flex; align-items: center; gap: 8px; }
.bn-card-title { font-size: 15px; font-weight: 600; flex: 1; min-width: 0; margin: 0; }
.bn-titlein { flex: 1; min-width: 0; font-family: inherit; font-weight: 600; font-size: 15px; padding: 4px 8px; border: 1px solid var(--bl);
  border-radius: var(--r2); background: var(--s); color: var(--tx); }
.bn-date { border: 1px solid transparent; background: transparent; color: var(--tx2); font: inherit; font-size: 13px; padding: 4px; border-radius: var(--r2); }
.bn-date:hover, .bn-date:focus { border-color: var(--bd); }
.bn-more { border: none; background: transparent; color: var(--tx2); font-size: 18px; line-height: 1; width: 32px; height: 32px;
  border-radius: var(--r2); cursor: pointer; }
.bn-more:hover { background: var(--bg); }
.bn-menu { position: absolute; right: 12px; top: 46px; z-index: 4; background: var(--s); border: 1px solid var(--bd);
  border-radius: var(--r2); box-shadow: var(--sh2); padding: 4px; min-width: 160px; }
.bn-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: none; background: none; color: var(--tx);
  font: inherit; font-size: 14px; cursor: pointer; border-radius: 4px; }
.bn-menu button:hover { background: var(--bg); }
.bn-danger { color: var(--ac) !important; }

.bn-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; }
.bn-mf { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--tx2); }
.bn-mf input { width: 9em; padding: 4px 6px; border: 1px solid var(--bd); border-radius: var(--r2); background: var(--s2);
  color: var(--tx); font: inherit; font-size: 13px; }
.bn-mf em { font-style: normal; color: var(--tx3); }

/* ── grid ── */
.bn-gridwrap { overflow-x: auto; }   /* the one sideways scroll: inside a wide card, never the page */
.bn-grid { border-collapse: collapse; width: 100%; }
.bn-grid th, .bn-grid td { padding: 3px 6px; border-bottom: 1px solid var(--bd2); vertical-align: top; }
.bn-grid thead th { font-size: 12px; font-weight: 600; color: var(--tx2); text-align: right; white-space: nowrap; padding-top: 8px; }
.bn-grid thead th em, .bn-grid thead th input + em { font-style: normal; font-weight: 400; color: var(--tx3); }
.bn-grid tbody tr:last-child th, .bn-grid tbody tr:last-child td { border-bottom: none; }
.bn-rh { text-align: left !important; font-size: 13px; font-weight: 500; color: var(--tx2); padding-top: 9px !important;
  min-width: 6em; overflow-wrap: anywhere; }   /* labels wrap, never truncate */
textarea.bn-rlabel { display: block; resize: none; overflow: hidden; line-height: 1.35; field-sizing: content; }
.bn-rlabel, .bn-clabel { width: 100%; max-width: 16em; min-width: 7em; padding: 5px 6px; border: 1px dashed var(--bd); border-radius: var(--r2);
  background: transparent; color: var(--tx); font: inherit; font-size: 13px; }
.bn-clabel { width: 7em; min-width: 5em; text-align: right; font-weight: 600; }
.bn-grid td { text-align: right; }
/* Capped so a one-column table does not stretch a cell across the card. */
.bn-cell { width: 100%; max-width: 11em; min-width: 7ch; padding: 6px 8px; border: 1px solid var(--bd); border-left-width: 3px;
  border-radius: var(--r2); background: var(--s2); color: var(--tx); font: inherit; font-size: 15px;
  font-variant-numeric: tabular-nums; text-align: right; }
.bn-cell:not(.bn-num) { text-align: left; }
.bn-cell:focus { outline: none; border-color: var(--bl); background: var(--s); box-shadow: 0 0 0 2px var(--bll); }
.bn-cell:disabled { background: transparent; border-color: transparent; color: var(--tx); }
.bn-cell.bn-st-pending { border-left-color: var(--am); }
.bn-cell.bn-st-error   { border-left-color: var(--ac); }
.bn-arr { font-size: 11px; color: var(--tx3); text-align: right; padding: 2px 2px 0; white-space: nowrap; font-variant-numeric: tabular-nums; }

.bn-card-ft { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 14px 12px; }
.bn-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.bn-chip { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--bg); color: var(--tx2);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.bn-chip b { color: var(--tx); font-weight: 600; }
.bn-chip.empty b { color: var(--tx3); font-weight: 400; }
.bn-chip.warn { background: var(--aml); color: var(--am); cursor: help; }
.bn-chip.warn b { color: var(--am); }
.bn-confirm { font-size: 13px; flex-basis: 100%; }

/* ── job lists (Operations › Test Bench + copy typeahead) ── */
.bn-search { width: 100%; max-width: 640px; margin-bottom: 14px; padding: 10px 12px; font-size: 15px; border: 1px solid var(--bd);
  border-radius: var(--r2); background: var(--s); color: var(--tx); font-family: inherit; }
.bn-sec { font-size: 12px; font-weight: 600; color: var(--tx2); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; }
.bn-joblist { display: flex; flex-direction: column; gap: 2px; max-width: 900px; }
.bn-jobrow { display: flex; align-items: baseline; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid transparent;
  border-radius: var(--r2); background: var(--s); color: var(--tx); font: inherit; cursor: pointer; min-width: 0; }
.bn-jobrow:hover, .bn-jobrow:focus { border-color: var(--bd); background: var(--s2); outline: none; }
.bn-jr-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.bn-jr-cust { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bn-jr-eq { font-size: 12px; color: var(--tx3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bn-when { font-size: 12px; color: var(--tx3); white-space: nowrap; }

/* ── job-modal Tests tab entry ── */
.bn-entry { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 14px 16px; margin: 0 0 14px;
  background: var(--bll); border-radius: var(--r); font-size: 13px; color: var(--tx2); }
.bn-entry-btn { font-size: 15px; padding: 10px 18px; }

/* ── phone ── */
@media (max-width: 768px) {
  .bn-top { flex-wrap: wrap; padding: 10px 16px; gap: 8px; }
  .bn-id { flex-basis: 100%; flex-wrap: wrap; gap: 2px 10px; }
  .bn-eq { flex-basis: 100%; }
  .bn-close { margin-left: auto; }
  .bn-bars { padding: 6px 16px; gap: 6px; }
  .bn-tabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; }
  .bn-stabs { margin-left: 0; }
  .bn-body { padding: 12px 16px 40px; }
  .bn-card-hd { padding: 10px 12px 8px; }
  .bn-mf input { width: 7.5em; }
}
/* Coarse pointer: ≥40px targets (and forms.css already forces 16px inputs,
   which stops iOS zooming into a cell). */
@media (hover: none) and (pointer: coarse) {
  .bn-cell, .bn-rlabel, .bn-clabel, .bn-mf input, .bn-tab, .bn-pick, .bn-jobrow, .bn-more, .bn-link, .bn-pill { min-height: 40px; }
  .bn-more { width: 40px; }
}

/* Practice mode must be obvious next to the sync pill — "All saved" there means
   saved to a mock, not to WattDesk. */
.bn-practice { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--pp); background: var(--ppl);
  padding: 5px 8px; border-radius: 999px; white-space: nowrap; }
.bn-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 6px 14px 0; font-size: 12px; color: var(--tx3); }
.bn-preset { border: 1px dashed var(--bd); background: transparent; color: var(--tx2); border-radius: 999px; padding: 3px 9px;
  font-family: inherit; font-size: 12px; cursor: pointer; }
.bn-preset:hover { border-style: solid; color: var(--tx); }

/* ── phone: compact header that stays; tabs and banners scroll away ── */
@media (max-width: 768px) {
  .bn-shell { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .bn-body { overflow: visible; }
  .bn-top { position: sticky; top: 0; z-index: 6; display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center; gap: 2px 8px; padding: 8px 16px; flex-wrap: nowrap; }
  .bn-id { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 8px; flex-basis: auto; min-width: 0; }
  .bn-jobno { font-size: 15px; }
  .bn-cust { overflow: hidden; text-overflow: ellipsis; }
  .bn-eq { grid-column: 1 / -1; font-size: 12px; flex-basis: auto; }
  .bn-pill { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; padding: 6px 10px; }
  .bn-close { margin-left: 0; }
  .bn-practice { padding: 4px 6px; }
  .bn-banner { padding: 6px 16px; font-size: 12px; }
  /* Meta as ONE row of compact fields (label above, three across), not one per line. */
  .bn-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 8px; }
  .bn-mf { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 4px; font-size: 11px; min-width: 0; }
  .bn-mf span { grid-column: 1 / -1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bn-mf input { width: 100%; min-width: 0; padding: 4px 6px; }
  .bn-rh { min-width: 0; width: 42%; }
  .bn-rlabel { min-width: 0; max-width: none; }
}

/* ── report preview (right pane) — a picture of a document, so it stays
   paper-white in dark mode; screenshot it and send it while testing runs ── */
.bn-main { flex: 1; display: flex; min-height: 0; min-width: 0; }
.bn-prev { display: none; }
.bn-withprev .bn-prev { display: block; flex: 0 0 min(46%, 720px); overflow: auto; padding: 18px 20px 40px;
  background: var(--bg2, var(--bg)); border-left: 1px solid var(--bd); -webkit-overflow-scrolling: touch; }
/* Beside the preview the tables have half the room: one card per row. */
.bn-withprev .bn-cards { grid-template-columns: minmax(0, 1fr); }
.bn-prevbtn.on { background: var(--tx); color: var(--s); border-color: var(--tx); }
@media (max-width: 1099px) {
  /* Narrow: the preview takes the place of the tables while it is open. */
  .bn-withprev .bn-body { display: none; }
  .bn-withprev .bn-prev { flex: 1; border-left: none; }
}

.bn-paper { background: #fff; color: #1a1a1a; max-width: 680px; margin: 0 auto; padding: 22px 24px 18px;
  border: 1px solid #e3e3e3; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.06); font-size: 13px; line-height: 1.4; }
.bnp-hd { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 10px;
  border-bottom: 2px solid #b3261e; margin-bottom: 12px; }
.bnp-co { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #b3261e; }
.bnp-ti { font-size: 18px; font-weight: 700; margin-top: 2px; }
.bnp-asat { font-size: 11px; color: #6b6b6b; text-align: right; white-space: nowrap; }
.bnp-id { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.bnp-id th { text-align: left; font-weight: 500; color: #6b6b6b; padding: 3px 10px 3px 0; white-space: nowrap; width: 1%; }
.bnp-id td { padding: 3px 16px 3px 0; font-weight: 600; }
.bnp-none { color: #6b6b6b; padding: 16px 0; }
.bnp-sec { margin-top: 14px; break-inside: avoid; }
.bnp-sec h4 { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.bnp-meta { font-size: 12px; color: #555; margin-bottom: 4px; }
.bnp-meta b { color: #1a1a1a; font-weight: 600; }
.bnp-grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.bnp-grid th, .bnp-grid td { border: 1px solid #d9d9d9; padding: 4px 8px; vertical-align: top; }
.bnp-grid thead th { background: #f4f4f4; font-size: 12px; font-weight: 600; text-align: right; white-space: nowrap; }
.bnp-grid thead th:first-child { background: #f4f4f4; }
.bnp-grid thead th em { font-style: normal; font-weight: 400; color: #777; }
.bnp-grid tbody th { text-align: left; font-weight: 500; background: #fafafa; }
.bnp-grid td.n { text-align: right; }
.bnp-grid td.bnp-pass { color: #1b7a3a; font-weight: 600; }
.bnp-grid td.bnp-fail { color: #b3261e; font-weight: 600; }
.bnp-dash { color: #c2c2c2; }
.bnp-arr { font-size: 10.5px; color: #888; white-space: nowrap; }
.bnp-res { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bnp-res span { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: #eef5ef; color: #1b5e2f; }
.bnp-res span.w { background: #fdf1dc; color: #8a5300; }
.bnp-ft { margin-top: 16px; padding-top: 8px; border-top: 1px solid #e3e3e3; font-size: 11px; color: #777; }
@media (max-width: 768px) {
  /* The top bar gained the Report button: let it take as many auto columns as it has items. */
  .bn-top { grid-template-columns: minmax(0, 1fr); grid-auto-flow: column; grid-auto-columns: auto; }
  .bn-prevbtn { padding: 6px 8px; }
  .bn-withprev .bn-prev { padding: 12px 8px 40px; }
  .bn-paper { padding: 14px 12px; }
  .bnp-grid th, .bnp-grid td { padding: 3px 5px; }
}
