/* RM Quiz Builder - workings grid (2.22.0). The grid scrolls inside its own box;
   the page itself must never scroll sideways, so every wrapper is capped at 100%. */
.rmqb-wg { max-width: 100%; min-width: 0; box-sizing: border-box; }
.rmqb-wg-hint { margin: 0 0 6px; font-size: 13px; color: #555; }
.rmqb-wg-scroll {
	max-width: 100%;
	overflow-x: auto;
	overflow-y: auto;
	max-height: 26rem;
	-webkit-overflow-scrolling: touch;
	border: 1px solid #cfd4da;
	border-radius: 6px;
	background: #fff;
	overscroll-behavior-x: contain;
}
.rmqb-wg-scroll:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.rmqb-wg-table { border-collapse: collapse; width: max-content; min-width: 100%; margin: 0 !important; font-size: 14px; }
.rmqb-wg-table th,
.rmqb-wg-table td { border: 1px solid #e2e5e9; padding: 0 !important; margin: 0; }
.rmqb-wg-table thead th {
	position: sticky; top: 0; z-index: 1;
	background: #f3f4f6; font-weight: 600; font-size: 13px;
	padding: 6px 8px !important; text-align: left; white-space: nowrap;
}
.rmqb-wg-table thead th.rmqb-wg-num { text-align: right; }
.rmqb-wg-cell {
	display: block; width: 100%; box-sizing: border-box;
	border: 0 !important; border-radius: 0 !important; margin: 0 !important;
	padding: 6px 8px !important; min-height: 34px;
	font: inherit; font-size: 14px; background: transparent; color: inherit;
	box-shadow: none !important;
}
.rmqb-wg-cell.rmqb-wg-label { width: 11rem; }
.rmqb-wg-cell.rmqb-wg-num { width: 6.5rem; text-align: right; font-variant-numeric: tabular-nums; }
/* Row labels stay in view while the figures scroll sideways. */
.rmqb-wg-table tbody td:first-child,
.rmqb-wg-table thead th:first-child,
.rmqb-wg-table tfoot th:first-child { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 #e2e5e9; }
.rmqb-wg-table thead th:first-child { z-index: 2; background: #f3f4f6; }
.rmqb-wg-table tfoot th:first-child { background: #f9fafb; }
@media (max-width: 480px) {
	.rmqb-wg-cell.rmqb-wg-label { width: 8.5rem; }
	.rmqb-wg-cell.rmqb-wg-num { width: 5.75rem; }
}
.rmqb-wg-cell:focus { outline: 2px solid #2563eb; outline-offset: -2px; background: #f0f6ff; }
.rmqb-wg-table td.rmqb-wg-total,
.rmqb-wg-table tfoot td,
.rmqb-wg-table tfoot th {
	padding: 6px 8px !important; background: #f9fafb; font-weight: 600;
	text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 6.5rem;
}
.rmqb-wg-table tfoot th { text-align: left; }
.rmqb-wg-table tfoot tr { border-top: 2px solid #9ca3af; }
.rmqb-wg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.rmqb-wg-actions button {
	font: inherit; font-size: 13px; padding: 6px 12px; min-height: 36px;
	border: 1px solid #cfd4da; border-radius: 6px; background: #fff; color: #1f2937; cursor: pointer;
}
.rmqb-wg-actions button:hover { background: #f3f4f6; }
.rmqb-wg-narrative-label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 4px; }
.rmqb-wg-narrative {
	width: 100%; max-width: 100%; box-sizing: border-box; padding: 10px;
	border: 1px solid #ddd; border-radius: 4px; font-family: inherit; font-size: 14px; resize: vertical;
}
.rmqb-wg-locked .rmqb-wg-cell { cursor: default; }
.rmqb-wg-locked .rmqb-wg-cell:focus { background: transparent; }
.rmqb-wg-locked .rmqb-wg-hint { display: none; }
.rmqb-wg-locked .rmqb-wg-narrative { background: #f9fafb; }
@media (prefers-reduced-motion: no-preference) {
	.rmqb-wg-scroll { scroll-behavior: smooth; }
}
/* Student-typed column headings (only when the question sets none). */
.rmqb-wg-table thead th:has(.rmqb-wg-head) { padding: 0 !important; }
.rmqb-wg-head {
	display: block; width: 100%; box-sizing: border-box;
	border: 0 !important; border-radius: 0 !important; margin: 0 !important; box-shadow: none !important;
	padding: 6px 8px !important; background: transparent; font: inherit; font-weight: 600; font-size: 13px; color: inherit;
}
.rmqb-wg-head.rmqb-wg-num { text-align: right; width: 6.5rem; }
.rmqb-wg-head:not(.rmqb-wg-num) { width: 11rem; }
.rmqb-wg-head::placeholder { color: #6b7280; font-weight: 600; }
.rmqb-wg-head:focus { outline: 2px solid #2563eb; outline-offset: -2px; background: #f0f6ff; }
@media (max-width: 480px) {
	.rmqb-wg-head.rmqb-wg-num { width: 5.75rem; }
	.rmqb-wg-head:not(.rmqb-wg-num) { width: 8.5rem; }
}
.rmqb-wg-note { margin: 6px 0 0; padding: 6px 10px; font-size: 13px; color: #7c2d12; background: #fff7ed; border-left: 3px solid #f97316; border-radius: 4px; }
