/*
 * The net sheet's pages (templates/netsheet/), loaded on those pages alone,
 * after base.css: the sheet, and at the end the page of explanations, which is
 * otherwise drawn with the blocks' styles. Mobile-first: the rules for a
 * narrow screen come first, wider screens adjust them.
 *
 * Type here is in px, where base.css's is in rem: the grid's columns are px
 * widths picked by the grid's own width, and type that grew with the text
 * size a visitor's system asks for would spill out of them and overlap.
 * Browser zoom, which grows the columns too, still scales it.
 *
 * Colors come only from the theme's roles (--color-<role>), as in base.css;
 * a guard in internal/guard checks. Every field carries a marker, a line in the
 * field role (.marker), which the theme keeps at 3:1 against the page.
 *
 * The grid. One box (.grid-box) holds the column heads, the rows and the net
 * row. Its columns are sized from the grid's own width (container units,
 * never the window's), so a scrollbar that takes room cannot push a figure
 * half out of view: the container is the box's view (.grid-view), as wide as
 * the box shows, since Chromium measures a scrolling container with its
 * scrollbar. Two cases, picked by the number of price columns
 * (data-columns on .sheet) and the grid's width (container queries):
 *
 *   - The columns fit. The box does not scroll, so the heads stick to the
 *     window's top and the net row to its bottom while the grid is in view.
 *   - They do not (a narrow screen with a pinned price, a narrower one with
 *     many). The box scrolls both ways, no taller than the window, and the
 *     heads, the net row and the name column stick inside it; the price
 *     columns move sideways a whole column at a time (scroll-snap), so a
 *     figure is never partly shown. No script is needed for the heads and the
 *     net row to follow the columns: they scroll with them.
 *
 * Sticky rows would hide a focused field under them, so the scrolling box,
 * and the window, keep the rows that stay in view clear (scroll-padding).
 *
 * With script the page is live (sheet.js marks the form .live): Update is
 * hidden, Copy link and Print are shown, the net row can show the live net in
 * its name cell, and a status line says when the sheet cannot update and what
 * became of Copy link.
 *
 * On paper the page is the sheet as it is printed alone, a plain rendering the
 * server draws inside the sheet and the screen never shows (the end of this
 * file).
 *
 * Column sizes. On a narrow grid the name column is fixed and the others are
 * each a share of what is left (two, three, four or five to a view as the grid
 * widens). On a wide one they have widths of their own and a last column takes
 * the rest; that is used wherever all the columns fit at those widths:
 *
 *   compact  name 220, cells 184, live 116, each pinned 104, last at least 40:
 *            456 + 104 per price column (560, 664, 768, 872, 976, 1080, 1184)
 *   roomy    name 300, cells 212, each price 120, last at least 40, for up to
 *            four price columns: 552 + 120 per price column (672, 792, 912, 1032)
 */

:root {
	/* The heights of the rows that stay in view, with room to spare: the
	   column heads, and the net row with any words under it. */
	--head-h: 64px;
	--net-h: 88px;
}
/* While the grid is in view, a focused field is kept clear of them: on the
   sheet's page alone, since the page of explanations loads this stylesheet
   too and its addresses must land on their headings. */
:root:has(.sheet-page) {
	scroll-padding-top: var(--head-h);
	scroll-padding-bottom: var(--net-h);
}
:root:has(.net-note, .sheet-status:not(:empty)) {
	--net-h: 168px;
}
@media (min-width: 761px) {
	:root {
		--net-h: 64px;
	}
	:root:has(.net-note, .sheet-status:not(:empty)) {
		--net-h: 120px;
	}
}

/* ---- The title line and the price ------------------------------------------ */

/* The sheet starts right under the header. */
.site > main:has(> .sheet-page) {
	padding-top: 4px;
}

.sheet-title {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	row-gap: 6px;
	margin: 4px 0 14px;
	font-size: 17px;
	font-weight: 700;
	line-height: var(--super-leading);
	letter-spacing: var(--super-tracking);
	text-transform: uppercase;
	color: var(--color-heading);
}
.title-sep {
	white-space: pre;
}
/* The address, typed into the title line: a quiet field, sized to what is in it. */
.title-address {
	field-sizing: content;
	min-width: 14ch;
	max-width: 100%;
	margin-left: 10px;
	padding: 1px 4px 2px;
	border: 0;
	border-bottom: 1.5px solid var(--color-field);
	background: none;
	font: 600 17px/1.25 var(--font-sans);
	letter-spacing: 0;
	text-transform: none;
	color: var(--color-ink);
}
.title-sep + .title-address {
	margin-left: 0;
}
.title-address:focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: 2px;
}
.sheet-page ::placeholder {
	color: var(--color-placeholder);
	opacity: 1;
	font-weight: 400;
}

.price-bar {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 10px 14px;
	align-items: center;
}
.price-cell {
	grid-column: 1 / -1;
	padding: 8px 14px 10px;
	border: 1px solid var(--hairline);
	background: var(--color-surface);
}
.price-cell:focus-within {
	outline: 2px solid var(--color-focus);
	outline-offset: -2px;
}
.price-cell label {
	display: block;
	margin-bottom: 4px;
	font: 400 12.5px/1.2 var(--font-mono);
}
.price-in {
	display: flex;
	align-items: baseline;
	gap: 4px;
	border-bottom: 1.5px solid var(--color-field);
}
.price-in .unit {
	font-size: 22px;
	font-weight: 600;
}
.price-in input {
	width: 100%;
	min-width: 0;
	padding: 0;
	border: 0;
	background: none;
	font: 700 28px/1.1 var(--font-sans);
	font-variant-numeric: tabular-nums;
	color: var(--color-heading);
}
.price-in input:focus {
	outline: none;
}
.price-in input::placeholder {
	font-size: 22px;
}
.slide {
	grid-column: 1;
	min-width: 0;
}
/* The range control: a hairline track and a round thumb in the figures'
   color, ringed with the accent. Without script moving it changes nothing,
   since the typed price is the one the sheet takes; with script the sheet
   follows it. */
.range {
	display: block;
	width: 100%;
	height: 24px;
	margin: 0;
	background: none;
	-webkit-appearance: none;
	appearance: none;
}
.range::-webkit-slider-runnable-track {
	height: 3px;
	background: var(--color-rule);
}
.range::-webkit-slider-thumb {
	width: 18px;
	height: 18px;
	margin-top: -7.5px;
	border: 0;
	border-radius: 50%;
	background: var(--color-heading);
	box-shadow: 0 0 0 3px var(--color-page), 0 0 0 4.5px var(--color-accent);
	-webkit-appearance: none;
	appearance: none;
}
.range::-moz-range-track {
	height: 3px;
	background: var(--color-rule);
}
.range::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border: 0;
	border-radius: 50%;
	background: var(--color-heading);
}
.range:focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: 3px;
}
.price-actions {
	grid-column: -2 / -1;
	display: flex;
	gap: 8px;
	justify-self: end;
}

/* Buttons: a quiet box; Update, the form's own action, takes the accent. */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 7px 14px;
	border: 1.5px solid var(--color-field);
	border-radius: 6px;
	background: none;
	font: 600 15px/var(--ui-leading) var(--font-sans);
	color: var(--color-ink);
	white-space: nowrap;
	cursor: pointer;
}
.btn:hover:enabled {
	background: var(--color-ink);
	color: var(--color-page);
}
.btn-primary,
.btn-primary:hover:enabled {
	border-color: var(--color-accent);
	background: var(--color-accent);
	color: var(--color-on-accent);
}
.btn-primary:hover:enabled {
	border-color: var(--color-ink);
}
.sheet-page button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}
/* A live page updates on each change: Update, and a row of buttons that
   holds nothing else, are not shown. What only script does, such as Copy
   link, is shown only on a live page. */
.sheet-page.live .update,
.sheet-page.live .actions:not(:has(> :not(.update))),
.sheet-page:not(.live) .live-only {
	display: none;
}
/* A link that looks like its row's buttons, as Start over does. */
a.btn {
	text-decoration: none;
}
a.btn:hover {
	background: var(--color-ink);
	color: var(--color-page);
}

/* What the sheet cannot read or take, and what the result says about the
   whole sheet: plain words in a box. A problem is in the warning's colors. */
.problem {
	margin: 4px 0 0;
	padding: 4px 8px;
	background: var(--color-warn-soft);
	color: var(--color-on-warn-soft);
	font-size: 14px;
	line-height: var(--ui-leading);
}
.sheet-messages {
	display: grid;
	gap: 6px;
	margin-top: 14px;
}
.sheet-messages p {
	margin: 0;
}
.sheet-messages .note {
	font-size: 14px;
	line-height: var(--text-leading);
}

/* ---- The grid ---------------------------------------------------------------- */

.sheet {
	container: sheet / inline-size;
	margin-top: 18px;
}
.grid-box {
	border-top: 1px solid var(--hairline);
	background: var(--color-surface);
	/* Narrow: a fixed name column, and two of the other columns to a view. */
	--name: 124px;
	--per-view: 2;
	--col: calc((100cqw - var(--name)) / var(--per-view));
	--cols: var(--name) repeat(var(--values), var(--col));
}
/* The box's view: as wide as the box shows, its scrollbar left out, the
   width the grid's columns and its rows across it are sized from. Chromium
   measures a container that scrolls with its scrollbar, so the box cannot be
   the container: where a scrollbar takes room, a row across the grid would
   reach under it and, scrolled to the end, sit that much to the left. */
.grid-view {
	container: grid / inline-size;
}
.grid {
	width: max-content;
	min-width: 100%;
}

/* The number of price columns: the cells' column and the price columns are
   the "values" a narrow grid shares out; a wide one has a template per count. */
.sheet[data-columns='1'] { --values: 2; }
.sheet[data-columns='2'] { --values: 3; }
.sheet[data-columns='3'] { --values: 4; }
.sheet[data-columns='4'] { --values: 5; }
.sheet[data-columns='5'] { --values: 6; }
.sheet[data-columns='6'] { --values: 7; }
.sheet[data-columns='7'] { --values: 8; }
.sheet[data-columns='1'] .grid-box { --wide: var(--name) var(--entry) var(--live) var(--add); --per-view: 2; }
.sheet[data-columns='2'] .grid-box { --wide: var(--name) var(--entry) var(--live) var(--num) var(--add); }
.sheet[data-columns='3'] .grid-box { --wide: var(--name) var(--entry) var(--live) repeat(2, var(--num)) var(--add); }
.sheet[data-columns='4'] .grid-box { --wide: var(--name) var(--entry) var(--live) repeat(3, var(--num)) var(--add); }
.sheet[data-columns='5'] .grid-box { --wide: var(--name) var(--entry) var(--live) repeat(4, var(--num)) var(--add); }
.sheet[data-columns='6'] .grid-box { --wide: var(--name) var(--entry) var(--live) repeat(5, var(--num)) var(--add); }
.sheet[data-columns='7'] .grid-box { --wide: var(--name) var(--entry) var(--live) repeat(6, var(--num)) var(--add); }

/* A narrower grid shows more of the columns to a view as it widens. */
@container sheet (min-width: 520px) {
	.grid-box { --name: 150px; --per-view: 3; }
}
@container sheet (min-width: 760px) {
	.grid-box { --name: 180px; --per-view: 4; }
}
@container sheet (min-width: 1000px) {
	.grid-box { --name: 200px; --per-view: 5; }
}

/* Wide, compact: wherever every column fits at the compact widths. */
@container sheet (min-width: 560px) {
	.sheet[data-columns='1'] .grid-box { --cols: var(--wide); --name: 220px; --entry: 184px; --live: 116px; --num: 104px; --add: minmax(40px, 1fr); }
}
@container sheet (min-width: 664px) {
	.sheet[data-columns='2'] .grid-box { --cols: var(--wide); --name: 220px; --entry: 184px; --live: 116px; --num: 104px; --add: minmax(40px, 1fr); }
}
@container sheet (min-width: 768px) {
	.sheet[data-columns='3'] .grid-box { --cols: var(--wide); --name: 220px; --entry: 184px; --live: 116px; --num: 104px; --add: minmax(40px, 1fr); }
}
@container sheet (min-width: 872px) {
	.sheet[data-columns='4'] .grid-box { --cols: var(--wide); --name: 220px; --entry: 184px; --live: 116px; --num: 104px; --add: minmax(40px, 1fr); }
}
@container sheet (min-width: 976px) {
	.sheet[data-columns='5'] .grid-box { --cols: var(--wide); --name: 220px; --entry: 184px; --live: 116px; --num: 104px; --add: minmax(40px, 1fr); }
}
@container sheet (min-width: 1080px) {
	.sheet[data-columns='6'] .grid-box { --cols: var(--wide); --name: 220px; --entry: 184px; --live: 116px; --num: 104px; --add: minmax(40px, 1fr); }
}
@container sheet (min-width: 1184px) {
	.sheet[data-columns='7'] .grid-box { --cols: var(--wide); --name: 220px; --entry: 184px; --live: 116px; --num: 104px; --add: minmax(40px, 1fr); }
}
/* Wide, roomy: up to four price columns, where they fit. */
@container sheet (min-width: 672px) {
	.sheet[data-columns='1'] .grid-box { --name: 300px; --entry: 212px; --live: 120px; --num: 120px; --tag-at: static; --tag-room: 0px; }
}
@container sheet (min-width: 792px) {
	.sheet[data-columns='2'] .grid-box { --name: 300px; --entry: 212px; --live: 120px; --num: 120px; --tag-at: static; --tag-room: 0px; }
}
@container sheet (min-width: 912px) {
	.sheet[data-columns='3'] .grid-box { --name: 300px; --entry: 212px; --live: 120px; --num: 120px; --tag-at: static; --tag-room: 0px; }
}
@container sheet (min-width: 1032px) {
	.sheet[data-columns='4'] .grid-box { --name: 300px; --entry: 212px; --live: 120px; --num: 120px; --tag-at: static; --tag-room: 0px; }
}

/* The last column, which takes what is left, is on a wide grid only. */
.c.add-col {
	display: none;
}
@container sheet (min-width: 560px) { .sheet[data-columns='1'] .c.add-col { display: flex; } }
@container sheet (min-width: 664px) { .sheet[data-columns='2'] .c.add-col { display: flex; } }
@container sheet (min-width: 768px) { .sheet[data-columns='3'] .c.add-col { display: flex; } }
@container sheet (min-width: 872px) { .sheet[data-columns='4'] .c.add-col { display: flex; } }
@container sheet (min-width: 976px) { .sheet[data-columns='5'] .c.add-col { display: flex; } }
@container sheet (min-width: 1080px) { .sheet[data-columns='6'] .c.add-col { display: flex; } }
@container sheet (min-width: 1184px) { .sheet[data-columns='7'] .c.add-col { display: flex; } }

/* The columns overflow: a pinned price on a narrow grid. The box scrolls both
   ways, no taller than the window, and rests on whole columns. Where they fit
   again, it is an ordinary box. */
.sheet:not([data-columns='1']) .grid-box {
	overflow: auto;
	/* The window's height, less the room the window keeps clear above a
	   focused field, so the whole box stays in view when one is focused. */
	max-height: calc(100svh - var(--head-h));
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-padding: var(--head-h) 0 var(--net-h) var(--name);
}
@container sheet (min-width: 520px) { .sheet[data-columns='2'] .grid-box { overflow: visible; max-height: none; scroll-snap-type: none; } }
@container sheet (min-width: 760px) { .sheet[data-columns='3'] .grid-box { overflow: visible; max-height: none; scroll-snap-type: none; } }
@container sheet (min-width: 872px) { .sheet[data-columns='4'] .grid-box { overflow: visible; max-height: none; scroll-snap-type: none; } }
@container sheet (min-width: 976px) { .sheet[data-columns='5'] .grid-box { overflow: visible; max-height: none; scroll-snap-type: none; } }
@container sheet (min-width: 1080px) { .sheet[data-columns='6'] .grid-box { overflow: visible; max-height: none; scroll-snap-type: none; } }
@container sheet (min-width: 1184px) { .sheet[data-columns='7'] .grid-box { overflow: visible; max-height: none; scroll-snap-type: none; } }
.grid-box:focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: 2px;
}
/* Each price column, and the cells' column, is a place to rest. Every row's
   cells mark them: Chromium snaps only to places in view across the box, and
   would not snap to the sticky heads' cells alone. */
.row > .c:not(.name, .add-col) {
	scroll-snap-align: start;
}

/* ---- Rows and cells ------------------------------------------------------------ */

.row {
	display: grid;
	grid-template-columns: var(--cols);
	min-height: 42px;
	border-bottom: 1px solid var(--hairline);
}
.c {
	display: flex;
	align-items: center;
	min-width: 0;
	padding: 6px 7px;
	line-height: var(--ui-leading);
}
/* Between a row's cells; a line's ⓘ sits between its name and its entry. */
.c ~ .c {
	border-left: 1px solid var(--hairline);
}
/* Only the name column stays put when the grid moves sideways. */
.c.name {
	position: sticky;
	left: 0;
	z-index: 2;
	gap: 8px;
	background: var(--color-surface);
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1.2;
}

/* A row whose one cell runs across the grid: a heading, a note, a problem,
   the questions, the button that adds a line. The cell stays at the grid's
   left, as wide as the grid's view. */
.row.sec,
.row.note-row,
.row.add-row,
.row.questions {
	display: block;
	min-height: 0;
}
.row.sec > .c,
.row.note-row > .c,
.row.questions > .c {
	position: sticky;
	left: 0;
	width: 100cqw;
}

/* The column heads: they stay at the top while the grid scrolls. */
.row.head {
	position: sticky;
	top: 0;
	z-index: 4;
	min-height: 52px;
	background: var(--color-surface);
}
.row.head .c {
	align-items: flex-end;
	padding-bottom: 7px;
}
.row.head .c.name {
	z-index: 5;
}
.entry-h {
	font: 400 12.5px/1.2 var(--font-mono);
}
.ph {
	flex-direction: column;
	align-items: flex-end !important;
	justify-content: flex-end;
	gap: 3px;
}
.ph-label {
	display: flex;
	align-items: center;
	gap: 5px;
	font: 400 12.5px/1.2 var(--font-mono);
}
.ph.live .ph-label::before {
	content: '';
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--color-accent);
}
.ph-price {
	display: flex;
	align-items: baseline;
	justify-content: flex-end;
	gap: 2px;
	font-size: 16px;
	font-weight: 700;
	color: var(--color-heading);
}
.ph-price:empty::after {
	content: '\2014';
	font-weight: 400;
	color: var(--color-ink-soft);
}
.ph-price.marker {
	border-bottom: 1.5px solid var(--color-field);
}
.ph-price input {
	width: 6.4ch;
	padding: 0 0 1px;
	border: 0;
	background: none;
	font: 600 15px/1.2 var(--font-sans);
	font-variant-numeric: tabular-nums;
	color: var(--color-heading);
	text-align: right;
}
.ph-price input:focus {
	outline: none;
}
.ph:focus-within {
	outline: 2px solid var(--color-focus);
	outline-offset: -2px;
}
.ph .problem {
	font-size: 12px;
}
.unpin,
.remove {
	flex: none;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 1px solid var(--color-field);
	border-radius: 50%;
	background: none;
	font: 600 14px/1 var(--font-sans);
	color: var(--color-ink);
	cursor: pointer;
}
.plus {
	width: 28px;
	height: 28px;
	padding: 0;
	border: 1px solid var(--color-field);
	border-radius: 4px;
	background: none;
	font: 400 19px/1 var(--font-sans);
	color: var(--color-ink);
	cursor: pointer;
}
.c.add-col {
	padding: 0 0 0 6px;
	justify-content: flex-start;
}
.row.head .c.add-col {
	align-items: center;
	padding-bottom: 0;
}

/* Headings: the catalog's groups and sections, marked with the accent. */
.row.sec > .c {
	gap: 9px;
	padding: 16px 10px 7px;
}
.row.sec > .c::before {
	content: '';
	flex: none;
	width: 10px;
	height: 10px;
	border-radius: 2px;
	background: var(--color-accent);
}
.row.sec h2 {
	margin: 0;
	font-size: 13px;
	font-weight: 700;
	line-height: var(--super-leading);
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--color-heading);
}

/* A cell the visitor types in: its marker is the line under it. */
.c.entry {
	position: relative;
	gap: 4px;
}
.field {
	display: flex;
	flex: 1;
	align-items: baseline;
	gap: 3px;
	min-width: 0;
	border-bottom: 1.5px solid var(--color-field);
}
.field .unit {
	font-weight: 600;
}
.field input {
	flex: 1;
	width: 100%;
	min-width: 0;
	padding: 0 0 2px;
	border: 0;
	background: none;
	font: 600 15px/1.2 var(--font-sans);
	font-variant-numeric: tabular-nums;
	color: var(--color-ink);
	text-align: right;
}
.field input:focus {
	outline: none;
}
.c.entry:focus-within {
	outline: 2px solid var(--color-focus);
	outline-offset: -2px;
}
/* A cell that could not be read, or that the sheet has a problem with: a bar
   in the warning's color at its edge, and its words in the row under it. */
.c.entry:has([aria-invalid='true']),
.mini:has([aria-invalid='true']) {
	box-shadow: inset 4px 0 0 var(--color-warn);
}
/* A tagged cell (line.tmpl): every compensation cell, one still holding its
   typical estimate, and an empty one the sheet works out. A tag never moves a
   figure: every figure in the column keeps one right edge, tagged or not.
   Where the cells are at their roomiest (212 px, the roomy rules below, which
   set --tag-at and --tag-room), the tag sits in the field, after the dollar
   sign, at the left end of the cell, clear of the longest commission a cell
   is likely to hold ("2.75% + 1,295"), and a tagged row is as tall as any
   other. Anywhere narrower, the tag and such a figure would touch, so the tag
   goes under the figure, right-aligned, into room the row keeps under its
   cells: the figures, the name and the ⓘ stay level above it. A pinned
   price's own entry (below) hangs under its figure in the same room, which
   the row keeps at every width while it holds one. */
.grid-box {
	--tag-at: absolute;
	--tag-room: 14px;
	--own-room: 14px;
}
.row.line:has(> .c.entry.tagged) {
	--room: var(--tag-room);
}
.row.line:has(> .c.amt > .own-entry) {
	--room: max(var(--tag-room), var(--own-room));
}
.row.line:is(:has(> .c.entry.tagged), :has(> .c.amt > .own-entry)) {
	grid-template-rows: minmax(calc(42px + var(--room)), auto);
}
.row.line:is(:has(> .c.entry.tagged), :has(> .c.amt > .own-entry)) > .c {
	padding-bottom: calc(6px + var(--room));
}
.row.line:is(:has(> .c.entry.tagged), :has(> .c.amt > .own-entry)) > .info > summary {
	margin-bottom: calc(9px + var(--room));
}
.field {
	position: relative;
}
.tag {
	position: var(--tag-at);
	top: calc(100% + 4px);
	right: 0;
	flex: none;
	align-self: center;
	padding: 0 3px;
	border: 1px solid var(--hairline);
	border-radius: 3px;
	font: 400 10.5px/1.25 var(--font-mono);
	white-space: nowrap;
}
.unit + .tag {
	margin-left: 3px;
}
.tag + input {
	margin-left: 6px;
}
/* A worked-out cell shows its figure as an entry would (its placeholder,
   since it is no entry), in an entry's full ink, which some browsers would
   otherwise fade, and its tag only while its placeholder shows: typed over,
   the tag goes with the figure, as the sheet then drops it. With no figure
   yet the placeholder is a space (line.tmpl), so the tag goes as soon as
   anything is typed there too. */
.c.entry.calculated input::placeholder {
	color: inherit;
	font-weight: inherit;
	opacity: 1;
}
.c.entry.calculated:has(input:not(:placeholder-shown)) .tag {
	visibility: hidden;
}
/* A line of the visitor's own: its name is a field too. */
.own-name {
	flex: 1 1 6ch;
	min-width: 0;
	padding: 0 0 2px;
	border: 0;
	border-bottom: 1.5px solid var(--color-field);
	background: none;
	font: 600 15px/1.2 var(--font-sans);
	color: var(--color-ink);
}
.own-name:focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: 2px;
}

/* Figures: whole dollars, right-aligned; the live column's are bold. A
   figure's cell also holds its column's name for assistive technology, out of
   sight (.visually-hidden), placed against the cell so it never widens the
   page; an empty figure shows a dash. */
.c.amt {
	position: relative;
	justify-content: flex-end;
	font-weight: 500;
	color: var(--color-heading);
}
.c.amt.live {
	font-weight: 700;
}
.row.line .c.amt > span:empty::after,
.row.total .c.amt > span:empty::after {
	content: '\2014';
	font-weight: 400;
	color: var(--color-ink-soft);
}
/* A pinned price's own entry for a line that is a term of the offer
   (line.tmpl): a small note under its figure, at the figure's right edge, in
   the room the row keeps under its cells. The cell stacks the two, and the
   note gives back the height it takes, so the figure sits where it would
   alone, level with every other column's. */
.c.amt:has(> .own-entry) {
	flex-direction: column;
	align-items: flex-end;
	justify-content: center;
}
.own-entry {
	position: relative;
	top: 2px; /* clear of the figure's digits, still in the row's room */
	height: var(--own-room);
	margin-bottom: calc(-1 * var(--own-room));
	font: 400 11.5px/var(--own-room) var(--font-sans);
	color: var(--color-ink-soft);
	text-align: right;
	white-space: nowrap;
}

/* A note or a problem about the line above: one short line of words. */
.row.note-row > .c {
	margin: 0;
	padding: 7px 10px 8px;
	font-size: 14px;
	line-height: var(--text-leading);
}
.row.note-row > .c > * {
	max-width: 78ch;
}
.row.note-row > .problem {
	padding: 6px 10px;
}

/* ---- A line's ⓘ ------------------------------------------------------------------ */

/* The ⓘ: a small round button; open, it is pressed: it fills with the ink,
   a thin ring inside it, and on a line its box points up at it. It never
   opens on hover: it is a native disclosure, opened by click, tap, Enter or
   Space. */
.info > summary {
	display: grid;
	place-items: center;
	width: 24px;
	height: 24px;
	border: 1px solid var(--color-field);
	border-radius: 50%;
	list-style: none;
	font: 700 12.5px/1 var(--font-mono);
	color: var(--color-ink);
	cursor: pointer;
	/* Focused from the keyboard, it is brought into view with room under it
	   for what it opens, so the text is not left under the net row. */
	scroll-margin-bottom: 15rem;
}
.info > summary::-webkit-details-marker {
	display: none;
}
.info[open] > summary {
	border-color: var(--color-ink);
	background: var(--color-ink);
	box-shadow: inset 0 0 0 2px var(--color-ink), inset 0 0 0 3px var(--color-page);
	color: var(--color-page);
}
.info > summary:focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: 4px;
}

/* What it opens: the page's color on the ink, the inverse of the sheet. */
.info-text {
	position: relative;
	padding: 10px 14px 12px;
	background: var(--color-ink);
	color: var(--color-page);
	font-size: 15.5px;
	line-height: var(--text-leading);
}
.info-text p {
	max-width: 74ch;
	margin: 0;
}
.info-text .info-working {
	margin-top: 4px;
	font: 400 13.5px/1.35 var(--font-mono);
}
.info-text a {
	color: inherit;
	font-weight: 700;
	text-decoration-color: currentColor;
}
.info-text :focus-visible {
	outline-color: var(--color-page);
}

/* Under the words, a row of what the box does: More, the video, and, at its
   end, Close. Open, More takes the row's width and shows the explanation
   under itself; the video and Close move under the explanation, Close still
   last and at the right. With no script there is no Close, and a box with
   nothing else to do has no row. */
.info-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 18px;
	max-width: 74ch;
	margin-top: 10px;
}
.sheet-page:not(.live) .info-actions:not(:has(> :not(.info-close))) {
	display: none;
}
.info-more {
	min-width: 0;
}
.info-more[open] {
	flex-basis: 100%;
}
.info-more > summary {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 4px 10px 4px 8px;
	border: 1px solid currentColor;
	border-radius: 4px;
	list-style: none;
	font: 600 14px/1.2 var(--font-sans);
	cursor: pointer;
}
.info-more > summary::-webkit-details-marker {
	display: none;
}
.info-more > summary::before {
	content: '';
	flex: none;
	width: 6px;
	height: 8px;
	background: currentColor;
	clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.info-more[open] > summary::before {
	transform: rotate(90deg);
}
.info-more:not([open]) .info-less-word,
.info-more[open] .info-more-word {
	display: none;
}
.info-more > summary:focus-visible {
	outline: 2px solid var(--color-page);
	outline-offset: 2px;
}
.info-explanation {
	margin-top: 10px;
}
.info-text .info-explanation > * {
	max-width: 74ch;
	margin: 0;
}
.info-text .info-explanation > * + * {
	margin-top: 8px;
}
.info-explanation :is(ul, ol) {
	padding-left: 1.25em;
}
.info-explanation a {
	font-weight: inherit;
}
.info-close {
	margin-left: auto;
	padding: 4px 12px;
	border: 1px solid currentColor;
	border-radius: 4px;
	background: none;
	font: 600 14px/1.2 var(--font-sans);
	color: inherit;
	cursor: pointer;
}
.info-close:hover,
.info-more > summary:hover {
	background: var(--color-page);
	color: var(--color-ink);
}
.info-close:focus-visible {
	outline: 2px solid var(--color-page);
	outline-offset: 2px;
}

/* On a line, the ⓘ is a second row of the line's grid, across it and held
   at the grid's left like a note, empty until it opens. Its button is lifted
   into the name's cell, at its right, centred on a one-line row; the name
   keeps clear of it. */
.row.line {
	grid-template-rows: minmax(42px, auto);
	min-height: 0;
}
.row.line > .info {
	position: sticky;
	left: 0;
	z-index: 3;
	grid-row: 2;
	grid-column: 1 / -1;
	width: 100cqw;
}
.row.line > .info > summary {
	position: absolute;
	bottom: 100%;
	left: calc(var(--name) - 32px);
	margin-bottom: 9px;
}
.row.line:has(> .info) > .c.name {
	padding-right: 36px;
}
/* Open, the box points up at its ⓘ. */
.row.line > .info > .info-text::before {
	content: '';
	position: absolute;
	bottom: 100%;
	left: calc(var(--name) - 27px);
	width: 14px;
	height: 5px;
	background: var(--color-ink);
	clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

/* In a question's box, the ⓘ sits at the right of its label, and what it
   opens comes under the field, the box then as wide as the row. */
.mini:has(> .info) {
	position: relative;
}
.mini:has(> .info) > .mini-label {
	padding-right: 30px;
}
.mini > .info {
	order: 1;
}
.mini > .info > summary {
	position: absolute;
	top: 0;
	right: 0;
}
.mini > .info > .info-text {
	margin-top: 6px;
}
.mini:has(> .info[open]) {
	flex-basis: 100%;
}
.mini:has(> .info:focus-within) {
	outline: none;
}

/* ---- More costs ------------------------------------------------------------------ */

.more > summary {
	list-style: none;
	cursor: pointer;
}
.more > summary::-webkit-details-marker {
	display: none;
}
.more > summary:focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: -2px;
}
.more-row .c.name {
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 4px;
}
.more-control {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1px 6px;
	padding: 5px 8px 5px 6px;
	border: 1px solid var(--color-field);
	border-radius: 4px;
	font: 600 14px/1.2 var(--font-sans);
}
.more-control::before {
	content: '';
	flex: none;
	width: 6px;
	height: 8px;
	background: currentColor;
	clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.more[open] .more-control::before {
	transform: rotate(90deg);
}
.more-count {
	font: 400 12.5px/1.2 var(--font-mono);
	white-space: nowrap;
}
.more-note {
	font: 400 13px/1.3 var(--font-sans);
}

/* The questions that open More costs: small labelled cells, side by side. */
.questions-c {
	display: flex;
	flex-wrap: wrap;
	gap: 0 18px;
	padding: 6px 10px 12px;
}
.bill {
	display: contents;
}
.mini {
	display: flex;
	flex: 1 1 8rem;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
	margin: 0;
	padding: 4px 4px 6px;
	border: 0;
}
.mini-label {
	padding: 0;
	font: 400 12.5px/1.2 var(--font-mono);
	color: var(--color-ink);
}
.mini > .marker:not(.seg) {
	display: flex;
	align-items: baseline;
	gap: 3px;
	border-bottom: 1.5px solid var(--color-field);
}
.mini input,
.mini select {
	width: 100%;
	min-width: 0;
	padding: 0 0 2px;
	border: 0;
	background: none;
	font: 600 15px/1.3 var(--font-sans);
	font-variant-numeric: tabular-nums;
	color: var(--color-ink);
}
.mini option {
	background: var(--color-page);
	color: var(--color-ink);
}
.mini input:focus,
.mini select:focus {
	outline: none;
}
.mini:focus-within {
	outline: 2px solid var(--color-focus);
	outline-offset: -2px;
}
.mini.paid {
	flex-basis: 100%;
}
@media (min-width: 761px) {
	.mini.paid {
		flex-basis: auto;
	}
}
.seg {
	display: inline-flex;
	align-self: flex-start;
	border: 1px solid var(--color-field);
	border-radius: 4px;
	overflow: hidden;
}
.seg label {
	position: relative;
}
.seg label + label {
	border-left: 1px solid var(--color-field);
}
.seg input {
	position: absolute;
	inset: 0;
	width: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}
.seg span {
	display: block;
	padding: 6px 8px;
	font: 600 12.5px/1 var(--font-mono);
	white-space: nowrap;
}
.seg input:checked + span {
	background: var(--color-ink);
	color: var(--color-page);
}
.seg input:focus-visible + span {
	outline: 2px solid var(--color-focus);
	outline-offset: -3px;
}
.mini.paid:focus-within {
	outline: none;
}
/* How much is paid is asked when some of the bill is. */
.bill:not(:has(input[value='some']:checked)) .paid-amount {
	display: none;
}

.row.add-row > .c {
	position: sticky;
	left: 0;
	width: max-content;
	padding: 6px 7px;
}
.add-line {
	padding: 5px 10px;
	border: 1px dashed var(--color-field);
	border-radius: 4px;
	background: none;
	font: 600 14px/1.2 var(--font-sans);
	color: var(--color-ink);
	cursor: pointer;
}

/* ---- Totals and the net row ------------------------------------------------------- */

.row.total {
	font-weight: 600;
}
.row.total:not(.received) {
	border-top: 1px solid var(--color-field);
}

/* The net row stays at the bottom while the grid scrolls, above the heads if
   the two ever meet, so it is the one painted whole. */
.net-wrap {
	position: sticky;
	bottom: 0;
	z-index: 6;
	background: var(--color-page);
}
.row.net {
	min-height: 52px;
	border-bottom: 0;
	background: var(--color-accent);
	color: var(--color-on-accent);
}
.row.net .c + .c {
	border-left-color: color-mix(in srgb, var(--color-on-accent) 22%, var(--color-accent));
}
.row.net .c.name {
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 1px;
	background: var(--color-accent);
}
.row.net strong {
	font-size: 14.5px;
	line-height: 1.15;
}
.row.net small {
	font: 400 12px/1.2 var(--font-mono);
}
.nb-price,
.nb {
	flex-direction: column;
	align-items: flex-end !important;
	justify-content: center;
	gap: 1px;
}
.nb-price span {
	font-weight: 700;
}
.row.net .c.amt {
	color: inherit;
}
.nb b {
	font-size: 17px;
	line-height: 1.15;
}
.nb.live b:empty::after {
	content: '\2014';
	font-weight: 400;
}
/* Bringing money: the only warning on the page, by its color, its mark and
   its words. The whole row when the live price brings money; a pinned price's
   own cell when only it does. */
.row.net.brings,
.row.net.brings .c.name,
.nb.brings {
	background: var(--color-warn-soft);
	color: var(--color-on-warn-soft);
}
.row.net.brings .c + .c {
	border-left-color: color-mix(in srgb, var(--color-on-warn-soft) 22%, var(--color-warn-soft));
}
.row.net.brings strong::before {
	content: '!';
	display: inline-grid;
	place-items: center;
	width: 18px;
	height: 18px;
	margin-right: 6px;
	border-radius: 50%;
	background: var(--color-warn);
	color: var(--color-on-warn);
	font: 700 13px/1 var(--font-sans);
	vertical-align: -3px;
}
/* The live net, again, in the name cell: shown only while a live page has
   the live column scrolled out of view (sheet.js marks the form .live-out). */
.net-aside {
	display: none;
	align-items: baseline;
	gap: 5px;
}
.sheet-page.live-out .net-aside {
	display: flex;
}
.row.net .net-aside b {
	font-size: 17px;
	line-height: 1.15;
}
/* Where a live page says it cannot update: nothing while it has nothing to
   say, and kept in place so assistive technology hears it when it does. */
.sheet-status {
	position: sticky;
	left: 0;
	width: 100cqw;
	margin: 0;
}
.sheet-status:not(:empty) {
	padding: 8px 12px;
	border: 2px solid var(--color-warn);
	border-top: 0;
	background: var(--color-warn-soft);
	color: var(--color-on-warn-soft);
	font-size: 14.5px;
	font-weight: 600;
	line-height: var(--ui-leading);
}
/* What is said plainly there, not as a warning: what became of Copy link. */
.sheet-status.plain:not(:empty) {
	border: 1px solid var(--hairline);
	border-top: 0;
	background: var(--color-surface);
	color: var(--color-ink);
	font-weight: 400;
}
.net-note {
	position: sticky;
	left: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100cqw;
	margin: 0;
	padding: 8px 12px;
	border: 1px solid var(--hairline);
	border-top: 0;
	background: var(--color-surface);
	font-size: 14.5px;
	line-height: var(--ui-leading);
}
.net-note.brings {
	border: 2px solid var(--color-warn);
	border-top: 0;
	background: var(--color-warn-soft);
	color: var(--color-on-warn-soft);
	font-weight: 600;
}
.net-note.brings::before {
	content: '!';
	display: inline-grid;
	flex: none;
	place-items: center;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--color-warn);
	color: var(--color-on-warn);
	font: 700 14px/1 var(--font-sans);
}

/* ---- Under the grid --------------------------------------------------------------- */

.after .actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
}
/* The link to the sheet, shown to copy by hand where the page could not copy
   it, and, with no script, the line that a link needs script to open. */
.share-link {
	width: 100%;
	max-width: 78ch;
	margin-top: 12px;
	padding: 7px 10px;
	border: 1.5px solid var(--color-field);
	border-radius: 6px;
	background: var(--color-surface);
	font: 400 14px/var(--ui-leading) var(--font-mono);
	color: var(--color-ink);
}
.link-note {
	margin: 12px 0 0;
	font-size: 13px;
	line-height: var(--text-leading);
}
/* The estimate notice: small, under the grid, its row of actions and the
   question to an agent. */
.notice {
	max-width: 78ch;
	margin: 18px 0 0;
	font-size: 13px;
	line-height: var(--text-leading);
}
/* The one link to the page of longer explanations, under the notice. */
.explained-link {
	margin: 10px 0 0;
	font-size: 14px;
	line-height: var(--ui-leading);
}

/* ---- The question to an agent ------------------------------------------------------ */

/* The control in the row: a quiet button that is a native disclosure, with
   the triangle More costs has. It holds nothing: the question's form is its
   own form, after the sheet's (base.css draws it), and is shown on screen
   while the control is open, with or without script. Never on paper. */
.ask-toggle > summary {
	gap: 8px;
	list-style: none;
}
.ask-toggle > summary::-webkit-details-marker {
	display: none;
}
.ask-toggle > summary::before {
	content: '';
	flex: none;
	width: 6px;
	height: 8px;
	background: currentColor;
	clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.ask-toggle[open] > summary::before {
	transform: rotate(90deg);
}
.ask-toggle > summary:hover {
	background: var(--color-ink);
	color: var(--color-page);
}
.ask {
	display: none;
	margin-top: 16px;
}
@media screen {
	.sheet-page:has(#ask-toggle[open]) + .ask {
		display: block;
	}
}

/* ---- The page of explanations -------------------------------------------------------- */

/* The compensation notice belongs to the line under it, not the one above. */
.explained > .explained-notice {
	margin-top: 28px;
}
.explained > .explained-notice + .heading-3 {
	margin-top: 12px;
}

/* ---- Wider screens ------------------------------------------------------------------ */

@media (min-width: 761px) {
	.sheet-title {
		margin: 6px 0 18px;
		font-size: 20px;
	}
	.price-bar {
		grid-template-columns: 280px minmax(0, 1fr) auto;
		gap: 0 28px;
		margin-top: 14px;
	}
	.price-cell,
	.slide {
		grid-column: auto;
	}
	.price-actions {
		grid-column: -2 / -1;
	}
	.c {
		padding: 6px 10px;
	}
	.c.name {
		font-size: 16px;
	}
	.field input {
		font-size: 16px;
	}
	.tag {
		font-size: 11px;
	}
	.mini {
		flex: 0 1 11rem;
	}
	/* An opened question keeps its label and field at a box's width, and its
	   ⓘ beside them; only what it opens takes the row. */
	.mini:has(> .info[open]) > :is(.mini-label, .marker) {
		max-width: calc(11rem - 8px); /* the box's, inside its padding */
	}
	.mini > .info > summary {
		right: auto;
		left: calc(11rem - 24px);
	}
	.row.net strong {
		font-size: 16px;
	}
	.nb b {
		font-size: 19px;
	}
	.nb.live b {
		font-size: 21px;
	}
}

/* ---- The sheet as it is printed ---------------------------------------------------- */

/* A second, plain rendering of the sheet (print.tmpl): never shown on screen,
   and on paper the only thing there is. */
.print-sheet {
	display: none;
}

/* On paper: the printed sheet alone, a white page with dark ink whatever the
   theme (base.css sets the roles to ink and paper). One table, its figures in
   columns of their own; the lines' names and up to seven prices (the live one
   and six pinned) fit across a portrait page of Letter or A4 in a smaller
   size, so the page never turns sideways. */
@media print {
	@page {
		margin: 0.5in;
	}
	.site:has(.print-sheet) {
		min-height: 0;
	}
	.site:has(.print-sheet) > :is(.site-header, .site-footer),
	.sheet-page > :not(.sheet-body),
	.sheet-body > :not(.print-sheet),
	.sheet-page ~ * {
		display: none;
	}
	.site > main:has(> .sheet-page) {
		max-width: none;
		padding: 0;
	}

	/* One column, centered on the page, whose every part shares the table's
	   left and right edges: with one or two prices as wide as the table reads
	   as a statement, 4.5 and 5.5 inches; with more, the full width between
	   the margins. */
	.print-sheet {
		display: block;
		color: black;
		font-size: 10pt;
		line-height: 1.35;
	}
	.print-sheet[data-columns='1'] {
		width: 4.5in;
		margin: 0 auto;
	}
	.print-sheet[data-columns='2'] {
		width: 5.5in;
		margin: 0 auto;
	}
	.print-top {
		display: flex;
		align-items: flex-end;
		justify-content: space-between;
		gap: 24pt;
	}
	/* The mark's own picture, every part of it in ink: on paper it takes no
	   theme's color, so it needs no mask, whose edge would print as a faint
	   line around it. */
	.print-mark {
		display: block;
		width: 1.35in;
		height: auto;
		filter: brightness(0);
	}
	.print-date {
		margin: 0;
	}
	.print-title {
		margin: 20pt 0 14pt;
		font-size: 15pt;
		font-weight: 700;
		line-height: 1.2;
		overflow-wrap: anywhere;
	}

	.print-table {
		width: 100%;
		border-collapse: collapse;
		font-variant-numeric: tabular-nums;
	}
	.print-table:is([data-columns='5'], [data-columns='6']) {
		font-size: 8.5pt;
	}
	.print-table[data-columns='7'] {
		font-size: 8pt;
	}
	.print-table th,
	.print-table td {
		padding: 2pt 0 2pt 10pt;
		font-weight: 400;
		text-align: right;
		vertical-align: baseline;
		white-space: nowrap;
	}
	.print-table tr > :first-child {
		padding-left: 0;
		text-align: left;
		white-space: normal;
	}
	.print-table thead th {
		padding-bottom: 4pt;
		border-bottom: 1pt solid black;
		font-weight: 700;
	}
	.print-label {
		display: block;
		font-weight: 400;
	}
	/* Under a figure of a line that is a term of the offer, the entry it
	   comes from: the row keeps its figures on one baseline. */
	.print-entry {
		display: block;
		font-size: 0.8em;
		line-height: 1.2;
	}
	.print-section th {
		padding-top: 10pt;
		font-size: 7.5pt;
		font-weight: 700;
		letter-spacing: 0.08em;
		text-transform: uppercase;
	}
	.print-aside td {
		padding-bottom: 3pt;
		font-size: 8pt;
		font-style: italic;
	}
	.print-totals tr:first-child > * {
		padding-top: 5pt;
		border-top: 1pt solid black;
	}
	.print-table .print-net > * {
		padding-top: 4pt;
		font-size: 1.1em;
		font-weight: 700;
	}
	.print-table .print-at-closing > * {
		font-size: 0.9em;
	}
	.print-table tr {
		break-inside: avoid;
	}
	.print-section {
		break-after: avoid;
	}

	.print-notes {
		margin: 14pt 0 0;
		padding-left: 12pt;
		font-size: 8.5pt;
	}
	.print-notes li + li {
		margin-top: 2pt;
	}
	.print-notice {
		margin: 12pt 0 0;
		font-size: 7.5pt;
		line-height: 1.4;
	}
	.print-brand {
		display: flex;
		flex-wrap: wrap;
		gap: 2pt 14pt;
		margin: 8pt 0 0;
		font-size: 8pt;
	}
	.print-brand > :first-child {
		font-weight: 700;
	}
}
