/* Pro-Tek Services — layout and components. */

/* --- Page shell ----------------------------------------------------- */

.topbar {
	background: var(--green);
	border-bottom: 3px solid var(--orange);
}
.topbar-inner {
	max-width: 1500px;
	margin: 0 auto;
	padding: 0 20px;
	display: flex;
	align-items: center;
	gap: 24px;
	min-height: 56px;
}
/* The logo has dark lettering and a green tagline, neither of which reads on
 * the green bar. It sits on a white chip so the artwork stays exactly as the
 * client's builders already know it, rather than being recoloured. */
.brand {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	background: var(--paper);
	border-radius: var(--radius);
	padding: 5px 10px;
}
.brand:hover { text-decoration: none; }
.brand img { height: 30px; width: auto; display: block; }
.brand .brand-fallback {
	color: #fff;
	font-weight: 700;
	font-size: 18px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.mainnav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.mainnav a {
	color: rgba(255, 255, 255, 0.92);
	padding: 7px 13px;
	border-radius: var(--radius);
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}
.mainnav a:hover { background: rgba(0, 0, 0, 0.14); color: #fff; text-decoration: none; }
.mainnav a.active { background: var(--orange); color: #fff; }

.userbox { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.userbox .who { color: #fff; font-size: 14px; text-align: right; line-height: 1.2; }
.userbox .who small { display: block; color: rgba(255, 255, 255, 0.7); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.userbox a.signout { color: rgba(255, 255, 255, 0.85); font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.userbox a.signout:hover { color: #fff; }

.container {
	max-width: 1500px;
	margin: 0 auto;
	padding: 18px 20px 48px;
}
.container.narrow { max-width: 900px; }

.page-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 14px;
}
.page-head .titles h1 { margin-bottom: 2px; }
.page-head .titles .sub { color: var(--ink-soft); font-size: 14px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Cards and layout ----------------------------------------------- */

.card {
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 14px 16px;
	margin-bottom: 16px;
}
.card > h2, .card > h3 { margin-top: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush table.data { border: 0; border-radius: 0; }

.card-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 16px;
	border-bottom: 1px solid var(--line);
	background: var(--panel);
}
.card-head h2, .card-head h3 { margin: 0; }

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: var(--gap);
}
.split {
	display: grid;
	grid-template-columns: 25% 1fr;
	gap: var(--gap);
	align-items: start;
}
@media (max-width: 900px) {
	.split { grid-template-columns: 1fr; }
}

/* --- Stats ---------------------------------------------------------- */

.stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 12px;
	margin-bottom: 16px;
}
.stat {
	background: var(--paper);
	border: 1px solid var(--line);
	border-left: 4px solid var(--green);
	border-radius: var(--radius);
	padding: 10px 14px;
}
.stat .label {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--ink-soft);
}
.stat .value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 0.8rem; color: var(--ink-soft); font-weight: 400; }
.stat.accent { border-left-color: var(--orange); }
.stat.quiet { border-left-color: var(--line); }

/* --- Login ---------------------------------------------------------- */

.login-page {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 24px;
	background:
		radial-gradient(1100px 500px at 50% -10%, rgba(0, 144, 76, 0.16), transparent 70%),
		linear-gradient(180deg, var(--page) 0%, #e7ebe8 100%);
}
.login-card {
	width: 100%;
	max-width: 380px;
	background: var(--paper);
	border: 1px solid var(--line);
	border-top: 4px solid var(--green);
	border-radius: 6px;
	padding: 26px 26px 22px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
}
.login-card .brand-mark { text-align: center; margin-bottom: 18px; }
.login-card .brand-mark img { max-width: 200px; height: auto; }
.login-card h1 { text-align: center; font-size: 1.1rem; margin-bottom: 16px; color: var(--ink-soft); }
.login-card .btn { width: 100%; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-wrap button {
	position: absolute;
	top: 0; right: 0;
	height: var(--field-h);
	padding: 0 10px;
	border: 0;
	background: none;
	color: var(--ink-soft);
	font-family: inherit;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	cursor: pointer;
}
.pw-wrap button:hover { color: var(--orange); }

/* --- Type-ahead ----------------------------------------------------- */

.typeahead { position: relative; }
.typeahead-list {
	position: absolute;
	z-index: 40;
	left: 0; right: 0;
	top: calc(100% + 2px);
	max-height: 260px;
	overflow-y: auto;
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
.typeahead-list li {
	list-style: none;
	padding: 6px 10px;
	cursor: pointer;
	font-size: 14px;
	border-bottom: 1px solid var(--line-soft);
}
.typeahead-list li:last-child { border-bottom: 0; }
.typeahead-list li:hover, .typeahead-list li[aria-selected="true"] { background: var(--mint); }
.typeahead-list li .meta { display: block; font-size: 12px; color: var(--ink-faint); }
.typeahead-list ul { margin: 0; padding: 0; }

/* --- Tabs ----------------------------------------------------------- */

.tabs {
	display: flex;
	gap: 2px;
	border-bottom: 2px solid var(--green);
	margin-bottom: 16px;
	flex-wrap: wrap;
}
.tabs button {
	border: 1px solid var(--line);
	border-bottom: 0;
	background: var(--panel);
	color: var(--ink-soft);
	font-family: inherit;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 8px 16px;
	border-radius: var(--radius) var(--radius) 0 0;
	cursor: pointer;
}
.tabs button:hover { color: var(--orange); }
.tabs button.active { background: var(--green); color: #fff; border-color: var(--green); }

.tabpane { display: none; }
.tabpane.active { display: block; }

/* --- Money summary (proposal screen) -------------------------------- */

.totals {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 10px 14px;
}
.totals dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; }
.totals dt { color: var(--ink-soft); font-size: 14px; }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand dt, .totals .grand dd {
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--green-dark);
	border-top: 1px solid var(--line);
	padding-top: 6px;
	margin-top: 4px;
}

.calc-note {
	font-size: 13px;
	color: var(--ink-soft);
	background: var(--paper);
	border: 1px dashed var(--line);
	border-radius: var(--radius);
	padding: 6px 9px;
	margin-top: 4px;
}
.calc-note strong { color: var(--ink); }

/* --- Misc ----------------------------------------------------------- */

.empty {
	padding: 28px 16px;
	text-align: center;
	color: var(--ink-faint);
	font-size: 14px;
}

.spinner-inline {
	display: inline-block;
	width: 12px; height: 12px;
	border: 2px solid var(--line);
	border-top-color: var(--green);
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
	vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media print {
	.topbar, .page-head .actions, .btn { display: none !important; }
	body { background: #fff; }
	.card { border: 0; padding: 0; }
}

/* --- Blueprint measuring -------------------------------------------- */

.measure-layout {
	display: grid;
	grid-template-columns: 300px 1fr;
	gap: 14px;
	align-items: start;
}
@media (max-width: 1100px) {
	.measure-layout { grid-template-columns: 1fr; }
}

.measure-side .card { margin-bottom: 0; }

.page-list { max-height: 46vh; overflow-y: auto; }
.page-item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	width: 100%;
	padding: 8px 12px;
	border: 0;
	border-left: 3px solid transparent;
	border-bottom: 1px solid var(--line-soft);
	background: var(--paper);
	font-family: inherit;
	font-size: 14px;
	color: var(--ink);
	cursor: pointer;
	text-align: left;
}
.page-item:hover { background: var(--panel); }
.page-item.active { background: var(--mint); border-left-color: var(--green); }
/* On a pre-construction termite job the foundation sheet is the one that
   matters, so it is marked out of a 40-page set. */
.page-item.foundation { border-left-color: var(--orange); }

.page-thumb {
	width: 54px;
	height: auto;
	flex-shrink: 0;
	border: 1px solid var(--line);
	background: #fff;
	display: block;
}
.page-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.page-meta strong { font-size: 13px; letter-spacing: 0.03em; }
.page-name {
	font-size: 13px;
	color: var(--ink-soft);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.page-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.page-tags .chip { font-size: 11px; padding: 1px 6px; }

.mark-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	border-bottom: 1px solid var(--line-soft);
	font-size: 14px;
}
.mark-row:last-child { border-bottom: 0; }
.mark-row .swatch {
	width: 12px;
	height: 12px;
	border-radius: 2px;
	flex-shrink: 0;
}

.measure-main {
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
}

.toolbar {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 8px 10px;
	background: var(--panel);
	border-bottom: 1px solid var(--line);
	flex-wrap: wrap;
}
.tool-group { display: flex; gap: 4px; align-items: center; }
.tool {
	height: 28px;
	padding: 0 11px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--paper);
	color: var(--ink);
	font-family: inherit;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	cursor: pointer;
}
.tool:hover { border-color: var(--orange); color: var(--orange); }
.tool.active { background: var(--green); border-color: var(--green); color: #fff; }
.zoom-chip {
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	min-width: 48px;
	text-align: center;
	color: var(--ink-soft);
}

.scale-bar {
	padding: 7px 12px;
	font-size: 14px;
	border-bottom: 1px solid var(--line);
}
.scale-bar.warn { background: var(--warn-bg); color: #7a4c06; }
.scale-bar.ok { background: var(--ok-bg); color: var(--green-dark); }

.stage {
	position: relative;
	height: 68vh;
	min-height: 420px;
	background:
		repeating-linear-gradient(0deg, #f4f6f5 0 24px, #eef1f0 24px 25px),
		repeating-linear-gradient(90deg, #f4f6f5 0 24px, #eef1f0 24px 25px);
	overflow: hidden;
	touch-action: none;
	cursor: grab;
}
.stage[data-tool="footprint"],
.stage[data-tool="wall_band"],
.stage[data-tool="deduction"],
.stage[data-tool="calibrate"] { cursor: crosshair; }
.stage[data-space] { cursor: grabbing; }
.stage canvas { position: absolute; inset: 0; }
#overlay { pointer-events: none; }

.stage-empty {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: var(--ink-faint);
	font-size: 14px;
	background: rgba(255, 255, 255, 0.85);
}

.live-readout {
	min-height: 30px;
	padding: 7px 12px;
	border-top: 1px solid var(--line);
	background: var(--panel);
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	color: var(--ink);
}

dialog {
	border: 1px solid var(--line);
	border-top: 4px solid var(--green);
	border-radius: 6px;
	padding: 20px 22px;
	max-width: 420px;
	width: calc(100% - 32px);
	box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
	color: var(--ink);
	font-family: inherit;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
dialog h2 { margin-top: 0; }

/* --- Drawing aids ----------------------------------------------------- */

kbd {
	display: inline-block;
	padding: 1px 5px;
	min-width: 16px;
	border: 1px solid var(--line);
	border-bottom-width: 2px;
	border-radius: 3px;
	background: var(--paper);
	color: var(--ink-soft);
	font-family: inherit;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
	text-align: center;
	white-space: nowrap;
}
.tool kbd {
	margin-left: 5px;
	padding: 0 4px;
	border-width: 1px;
	background: var(--panel);
	font-size: 11px;
}
.tool.active kbd {
	background: rgba(255, 255, 255, 0.22);
	border-color: rgba(255, 255, 255, 0.4);
	color: #fff;
}

/* The hint strip changes with what you are doing, so the useful keys are
   always on screen and nobody has to memorise them. */
.key-hints {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	padding: 7px 12px;
	border-top: 1px solid var(--line);
	background: var(--paper);
	font-size: 13px;
	color: var(--ink-soft);
}
.key-hints span { display: inline-flex; align-items: center; gap: 4px; }

#scratch { pointer-events: none; }

dialog.wide { max-width: 780px; }

.keys-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
	gap: 18px 24px;
}
.keys-grid h4 { margin-bottom: 6px; }
dl.keys {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 6px 10px;
	margin: 0;
	font-size: 14px;
}
dl.keys dt { white-space: nowrap; }
dl.keys dd { margin: 0; color: var(--ink-soft); }

/* A refused tool click flashes the scale bar, which explains what is missing. */
.scale-bar.flash { animation: scale-bar-flash 1.2s ease; }
@keyframes scale-bar-flash {
	0%, 100% { background: var(--warn-bg); }
	25%, 75% { background: var(--orange); color: #fff; }
}

.tool:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}
.tool:disabled:hover { border-color: var(--line); color: var(--ink); }

/* PlanFast-style plan drop zone: the whole box is the button. */
.upload-drop {
	display: flex;
	flex-direction: column;
	gap: 3px;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 16px 12px;
	border: 2px dashed var(--line);
	border-radius: var(--radius);
	background: var(--panel);
	cursor: pointer;
	user-select: none;
}
.upload-drop:hover, .upload-drop:focus-visible { border-color: var(--green); background: var(--ok-bg); outline: none; }
.upload-drop.drag { border-color: var(--orange); background: var(--warn-bg); }
.upload-drop .meta {
	font-size: 12px;
	color: var(--ink-faint);
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
	white-space: nowrap;
}

.progress {
	height: 6px;
	margin-top: 8px;
	border-radius: 3px;
	background: var(--line-soft);
	overflow: hidden;
}
.progress > div {
	height: 100%;
	width: 0;
	background: var(--green);
	transition: width 0.15s ease;
}
.hint.warn { color: var(--warn); }

/* --- Measuring workspace: the PlanFast viewer shell -------------------- */
/* Full-viewport three-column grid — sheets | canvas | takeoff — each column
 * scrolling by itself. The measurements panel lives on the RIGHT where it has
 * the height of the screen, not in a corner that grows off the bottom. */

.viewer-wrap {
	display: flex;
	flex-direction: column;
	height: calc(100vh - 59px);   /* below the top bar */
	overflow: hidden;
}

.context-bar {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 7px 14px;
	background: var(--paper);
	border-bottom: 1px solid var(--line);
	flex-shrink: 0;
}
.context-crumbs {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.context-msg { flex: 1; min-width: 0; }
.context-bar .notice {
	margin: 0;
	padding: 3px 10px;
	font-size: 13px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.viewer-shell {
	flex: 1;
	min-height: 0;
	display: grid;
	grid-template-columns: 260px minmax(0, 1fr) 300px;
}

/* Left: sheets */
.sheetbar {
	background: var(--paper);
	border-right: 1px solid var(--line);
	overflow-y: auto;
	padding: 10px;
}
.sheetbar .filter { margin: 6px 0 8px; }
.sheetbar .page-list { max-height: none; }
.sheetbar .page-item { border: 1px solid var(--line-soft); border-left-width: 3px; border-radius: var(--radius); margin-bottom: 6px; }

/* Centre: the sheet */
.canvas-stage {
	position: relative;
	overflow: hidden;
	touch-action: none;
	cursor: default;
	background:
		repeating-linear-gradient(0deg, #f4f6f5 0 24px, #eef1f0 24px 25px),
		repeating-linear-gradient(90deg, #f4f6f5 0 24px, #eef1f0 24px 25px);
}
.canvas-stage canvas { position: absolute; inset: 0; }
.canvas-stage[data-tool="footprint"],
.canvas-stage[data-tool="wall_band"],
.canvas-stage[data-tool="deduction"],
.canvas-stage[data-tool="calibrate"] { cursor: crosshair; }
.canvas-stage[data-space] { cursor: grabbing; }

.canvas-stage .stage-empty {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: var(--ink-faint);
	font-size: 14px;
	background: rgba(255, 255, 255, 0.85);
	z-index: 3;
}

.stage-toolbar {
	position: absolute;
	left: 10px;
	top: 10px;
	z-index: 5;
	display: flex;
	flex-direction: column;
	gap: 4px;
	background: rgba(255, 255, 255, 0.94);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 6px;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.10);
}
.stage-toolbar .tool {
	width: 36px;
	height: 34px;
	padding: 0;
	font-size: 15px;
	line-height: 1;
}
.stage-toolbar hr { margin: 2px 0; border: 0; border-top: 1px solid var(--line-soft); }

.viewer-hud {
	position: absolute;
	right: 10px;
	top: 10px;
	z-index: 5;
	display: flex;
	align-items: center;
	gap: 4px;
	background: rgba(255, 255, 255, 0.94);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 5px 6px;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.10);
}
.viewer-hud .tool { height: 28px; padding: 0 9px; }

.scale-chip {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 3px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
	white-space: nowrap;
}
.scale-chip.warn { background: var(--warn-bg); color: #7a4c06; border: 1px solid #e8cd9a; }
.scale-chip.ok { background: var(--ok-bg); color: var(--green-dark); border: 1px solid var(--mint); }
.scale-chip.flash { animation: scale-bar-flash 1.2s ease; }

.stage-foot {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 6px 12px;
	background: rgba(255, 255, 255, 0.94);
	border-top: 1px solid var(--line);
	font-size: 13px;
}
.stage-foot #readout { font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-foot .key-hints { border: 0; padding: 0; background: none; justify-content: flex-end; flex-shrink: 0; }

/* Right: the takeoff */
.takeoff-panel {
	background: var(--paper);
	border-left: 1px solid var(--line);
	overflow-y: auto;
	padding: 12px;
}
.takeoff-panel h3 { margin-bottom: 8px; }

.totals-box {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--panel);
	padding: 4px 0;
}
.totals-row {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	padding: 4px 10px;
	font-size: 14px;
}
.totals-row strong { font-variant-numeric: tabular-nums; }
.totals-row.grand { border-top: 1px solid var(--line); margin-top: 2px; padding-top: 6px; }
.totals-row.grand strong { color: var(--green-dark); }

.marks-list .mark-row { cursor: pointer; }
.marks-list .mark-row:hover { background: var(--panel); }
.marks-list .mark-row.selected { background: var(--mint); }
.mark-remove {
	width: 22px;
	height: 22px;
	border: 1px solid var(--line);
	border-radius: 50%;
	background: var(--paper);
	color: var(--ink-soft);
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	flex-shrink: 0;
}
.mark-remove:hover { border-color: var(--danger); color: var(--danger); }

/* Rows that open a record when clicked anywhere along them. */
tr.rowlink { cursor: pointer; }
tr.rowlink a { position: relative; }

/* --- Treatments catalog ----------------------------------------------- */
/* The catalog is the main event and gets the width; saved wording is a
 * narrow rail beside it. The edit form lives in a dialog, so nothing on the
 * page ever sits empty and only the page itself scrolls. */

.catalog-layout {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
	gap: var(--gap);
	align-items: start;
}
@media (max-width: 1200px) {
	.catalog-layout { grid-template-columns: 1fr; }
}

.head-count {
	font-size: 13px;
	color: var(--ink-soft);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.card-pad { padding: 12px 16px 14px; }

/* overflow-x:auto forces overflow-y to auto as well, and the collapsed table
 * borders leave the table a fraction of a pixel taller than the wrapper —
 * which draws a scrollbar that scrolls two useless pixels. Kill it here. */
.catalog-layout .table-wrap { overflow-y: hidden; padding-bottom: 2px; }
/* Same phantom-scrollbar cause as the catalog: overflow-x:auto forces an
   overflow context and the table lands a fraction of a pixel tall. The users
   table is four narrow columns — it never needs to scroll in any direction. */
#pane-users .table-wrap { overflow: visible; }

.catalog-table td { padding: 7px 12px; height: auto; }
.catalog-table td.wrapcell { max-width: 260px; }
.catalog-table tbody tr.selected { background: var(--mint); }

.catalog-layout .empty strong {
	display: block;
	color: var(--ink-soft);
	margin-bottom: 2px;
}

.card-pad #snippets {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: 12px;
}
.snippet-block {
	border: 1px solid var(--line);
	border-left: 3px solid var(--green);
	border-radius: var(--radius);
	background: var(--paper);
	padding: 10px 12px 8px;
}
.snippet-block .field:last-of-type { margin-bottom: 8px; }
.snippet-block textarea { min-height: 92px; }

#treatment-dialog { max-width: 820px; }
#treatment-dialog h2 {
	margin-bottom: 14px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--line-soft);
}

/* The route from the price column to the blueprint — a first-class action,
   not a mystery-disabled chip. */
.btn-measure {
	width: 100%;
	margin-top: 6px;
	background: var(--paper);
	color: var(--green-dark);
	border: 2px solid var(--green);
	font-size: 14px;
}
.btn-measure:hover, .btn-measure:focus {
	background: var(--green);
	border-color: var(--green-border);
	color: #fff;
}

/* List pagination: a screen's worth of rows, never an inner scrollbar. */
.pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 8px 12px;
	border-top: 1px solid var(--line);
	background: var(--panel);
}
.pager-label { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* A search row belonging to the list card beneath it. */
.card-search {
	padding: 8px 12px;
	background: var(--panel);
	border-bottom: 1px solid var(--line);
}
.card-search .typeahead { width: 100%; }

/* --- Bid queue --------------------------------------------------------- */

.bid-item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	width: 100%;
	padding: 9px 12px;
	border: 0;
	border-left: 3px solid transparent;
	border-bottom: 1px solid var(--line-soft);
	background: var(--paper);
	font-family: inherit;
	font-size: 14px;
	color: var(--ink);
	cursor: pointer;
	text-align: left;
}
.bid-item:hover { background: var(--panel); }
.bid-item.active { background: var(--mint); border-left-color: var(--green); }
.bid-thumb {
	width: 46px;
	height: 36px;
	object-fit: cover;
	object-position: top;
	flex-shrink: 0;
	border: 1px solid var(--line);
	background: #fff;
	display: block;
}
.bid-thumb.none {
	display: grid;
	place-items: center;
	color: var(--ink-faint);
	font-size: 16px;
}
.bid-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bid-title {
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.attach-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 10px;
}
.attach-card {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 8px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--panel);
	color: var(--ink);
	font-size: 13px;
	text-decoration: none;
}
.attach-card:hover { border-color: var(--green); text-decoration: none; color: var(--ink); }
.attach-card img { width: 100%; height: 110px; object-fit: cover; object-position: top; border: 1px solid var(--line); background: #fff; }
.attach-icon {
	display: grid;
	place-items: center;
	height: 110px;
	border: 1px dashed var(--line);
	color: var(--ink-faint);
	font-weight: 700;
	letter-spacing: 0.1em;
}
.attach-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mail-body {
	margin: 0;
	padding: 10px 12px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	font-family: inherit;
	font-size: 14px;
	white-space: pre-wrap;
	word-break: break-word;
	max-height: 320px;
	overflow-y: auto;
}

/* Termite findings on the bid card: the note quoted whole, its source, and
   the confirm step. A rejected finding fades but stays visible — the
   estimator's judgment is part of the record, not an eraser. */
.tfind {
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 10px 12px;
	margin: 8px 0;
	background: var(--panel, #fff);
}
.tfind.rejected { opacity: 0.55; }
.tfind-note {
	font-family: var(--mono, ui-monospace, monospace);
	font-size: 13px;
	line-height: 1.45;
	white-space: pre-wrap;
}
.tfind .page-tags { margin-top: 6px; }
