/* ===== Quality on a phone · tickets, scans, categories, defects, and PQP view only ===== */

/* ─── Section tabs and filters · thumb-sized tabs, the pickers on an even two-up grid ─── */
#tab-quality .tab-btn { min-height: var(--touch); }
#tab-quality .section-header .filter-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  width: 100%;
}
#tab-quality .section-header .form-field { min-width: 0; }
#tab-quality .section-header .form-field select,
#tab-quality .section-header .form-field input { width: 100%; min-height: var(--touch); }
/* a lone button or toggle in the row takes the whole line */
#tab-quality .section-header .filter-row > .btn-primary,
#tab-quality .section-header .filter-row > .btn-secondary,
#tab-quality .section-header .filter-row > .toggle-label { grid-column: 1 / -1; }
#tab-quality .section-header .filter-row > .btn-primary,
#tab-quality .section-header .filter-row > .btn-secondary { min-height: var(--touch); justify-content: center; }
#tab-quality .toggle-label { display: inline-flex; align-items: center; gap: 0.4rem; min-height: var(--touch); }


/* ─── List tables · card rows (workspace.css), the lead fact on top and the rest wrapped under it ─── */

/* the supporting facts share one small line, a dot between each */
#quality-tbody td:nth-child(n+2):nth-child(-n+5),
#quality-tbody td:nth-child(7),
#quality-sw-tbody td:nth-child(3),
#quality-sw-tbody td:nth-child(4),
#scans-feed-tbody td:nth-child(1),
#scans-feed-tbody td:nth-child(4),
#scans-feed-tbody td:nth-child(5),
#scans-feed-tbody td:nth-child(6),
#scans-feed-tbody td:nth-child(7),
#scans-feed-tbody td:nth-child(8),
#quality-defects-tbody td:nth-child(2),
#quality-defects-tbody td:nth-child(4) { order: 4; flex: none; font-size: 0.78rem; color: var(--text-muted); }
#quality-tbody td:nth-child(n+3):nth-child(-n+5)::before,
#quality-tbody td:nth-child(7)::before,
#quality-sw-tbody td:nth-child(4)::before,
#scans-feed-tbody td:nth-child(4)::before,
#scans-feed-tbody td:nth-child(5)::before,
#scans-feed-tbody td:nth-child(6)::before,
#scans-feed-tbody td:nth-child(8)::before,
#quality-defects-tbody td:nth-child(4)::before { content: "· "; color: var(--text-faint); }
/* a bare number needs its name back once the column header is gone */
#quality-tbody td:nth-child(2)::before { content: "File "; }
#scans-feed-tbody td:nth-child(5)::before { content: "· Params "; }
#scans-feed-tbody td:nth-child(6)::before { content: "· Out of tol. "; }
#scans-feed-tbody td:nth-child(8)::before { content: "· Photos "; }
#scans-feed-tbody td:nth-child(7)::before { content: "· Defects "; color: var(--text-faint); }
#quality-defects-tbody td:nth-child(4)::before { content: "· Seen "; }

/* File feedback · model and module lead, status beside, the message on its own line */
#quality-tbody td:nth-child(1) { order: 1; flex: 1 1 60%; font-weight: 600; }
#quality-tbody td:nth-child(8) { order: 2; flex: none; margin-left: auto; }
#quality-tbody td:nth-child(6) { order: 3; flex: 1 1 100%; }
#quality-tbody td:nth-child(9) { order: 5; flex: none; margin-left: auto; }

/* Software feedback · the reporter leads, status beside, the message under them */
#quality-sw-tbody td:nth-child(1) { order: 1; flex: 1 1 60%; font-weight: 600; }
#quality-sw-tbody td:nth-child(5) { order: 2; flex: none; margin-left: auto; }
#quality-sw-tbody td:nth-child(2) { order: 3; flex: 1 1 100%; }
#quality-sw-tbody td:nth-child(6) { order: 5; flex: none; margin-left: auto; }

/* Scans · the part and its verdict lead, the model line and any defect chips follow */
#scans-feed-tbody td:nth-child(3) { order: 1; flex: 1 1 50%; font-weight: 600; }
#scans-feed-tbody td:nth-child(9) { order: 2; flex: none; margin-left: auto; }
#scans-feed-tbody td:nth-child(2) { order: 3; flex: 1 1 100%; font-size: 0.85rem; }

/* Categories and defects · name, type and actions on one line, the defect's facts under it */
#quality-categories-tbody td:nth-child(1),
#quality-defects-tbody td:nth-child(1) { order: 1; flex: 1 1 40%; font-weight: 600; }
#quality-categories-tbody td:nth-child(2) { order: 2; flex: none; font-size: 0.78rem; color: var(--text-muted); }
#quality-defects-tbody td:nth-child(3) { order: 2; flex: none; }
#quality-categories-tbody td.col-action,
#quality-defects-tbody td.col-action { order: 3; flex: none; display: flex; gap: 0.1rem; }
/* a zero-height full-width item breaks the line, so the facts start under the name */
#quality-defects-tbody tr::after { content: ""; order: 3; flex-basis: 100%; height: 0; }
#quality-defects-tbody tr { row-gap: 0; }

/* every button in a card row is a thumb target */
.quality-resolve-btn,
.quality-sw-resolve-btn { min-height: var(--touch); padding: 0 1rem; }


/* ─── PQP, Scans By Part · wide grids keep their columns and scroll sideways inside their card ─── */
#quality-pqp .parameter-grid-pane { overflow: visible; padding: 0.5rem 0.4rem; }
#quality-pqp .table-scroll,
#quality-scans-by-part .table-scroll { overflow-x: auto; overscroll-behavior-x: contain; }

/* Scans pathbar on a phone · filter selects wrap to a second row and stretch to fill it */
#quality-scans .pathbar-group select,
#quality-scans .pathbar-group input { flex: 1 1 40%; min-height: var(--touch); }
/* the view-only chip leads the bar's actions, so it's the first thing seen past the trail */
#quality-pqp .phone-view-only-note { flex: none; }
#quality-pqp .pathbar .btn-secondary,
#quality-pqp .pathbar .btn-icon { min-height: var(--touch); }

/* the part's solid panel stacks under the grid with room for the stage */
#pqp-solid .tab-btn { min-height: var(--touch); }
#pqp-solid .stage3d { min-height: 18rem; }
