/* The module chrome. This was a Shoelace tab group: eight panels behind one URL, with the current tab
   underlined. It is now the same segmented control Cleaning carries, because two sibling modules whose
   navigation looks nothing alike read as two different products.

   The rules are a deliberate copy of cleaning.css's rather than a shared class. Cleaning scopes its own to
   cleaning-chrome for exactly this reason: one module quietly restyling the other's header is what element
   scoping in this codebase exists to prevent. */
maintenance-chrome {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

maintenance-management {
	flex: 1;
	display: flex;
	flex-direction: column;
}

maintenance-management {
	/* The segmented section marker. An inset track with the current section lifted out of it, so "where am I"
	   is answered by depth rather than by colour - which leaves the accent free to mean "the action to take".
	   Eight destinations against Cleaning's five, so this one is expected to wrap on a narrow pane rather
	   than merely allowed to. */
	maintenance-nav {
		display: inline-flex;
		flex-wrap: wrap;
		align-self: flex-start;
		gap: 0.15rem;
		margin: 0 1rem;
		padding: 0.25rem;
		border-radius: 999px;
		background: var(--deep-background-color);
		box-shadow: var(--soft-container-inner-shadow);
	}

	maintenance-nav button {
		padding: 0.45rem 1.1rem;
		border: none;
		border-radius: 999px;
		background: transparent;
		font-family: var(--global-font-family);
		font-size: var(--font-size-normal);
		color: var(--light-global-font-color);
		cursor: pointer;
		transition: background 0.15s ease, color 0.15s ease;
	}

	maintenance-nav button:hover {
		color: var(--global-font-color);
	}

	maintenance-nav button[aria-current="page"] {
		background: var(--plain-white);
		color: var(--global-font-color);
		font-weight: 600;
		box-shadow: var(--outline-button-shadow);
	}

	maintenance-nav button:focus-visible {
		outline: 2px solid var(--darker-primary-green);
		outline-offset: 2px;
	}

	/* The dashboard is fetched into its section page rather than composed with it, so that the refresh event
	   any part of the module raises redraws the figures without re-rendering the chrome above them. The
	   container carries no look of its own - maintenance-dashboard below brings its own padding. */
	dashboard-container {
		display: block;
		width: 100%;
	}

	equipment-management,
	actions-management {
		display: flex;
		flex-direction: column;
		height: 100%;
		gap: 1rem;
        padding: 1.5rem;
	}

	/* Auto-fill rather than a hard three columns, and auto rather than scroll, matching equipment-grid:
	   a fixed count leaves cards stretched across the full width on a narrow viewport, and a permanent
	   scroll gutter shows even when the list is two rows long. */
	actions-list {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
		gap: 2rem;
		width: 100%;
		height: 100%;
		overflow-y: auto;
		overflow-x: hidden;
        padding: 0.5rem;
	}

	/* The equipment list is no longer a grid of cards: it holds a toolbar and a set of collapsible category
	   groups, each of which contains its own grid (see equipment-grid). */
	equipment-list,
	equipment-list-archived,
	actions-list-archived {
		display: block;
		width: 100%;
		height: 100%;
		overflow-y: auto;
		overflow-x: hidden;
		padding: 0.5rem;
	}

	equipment-row {
		width: 100%;
		border-radius: 0.9rem;
		background: var(--blue-gray);
		box-shadow: var(--soft-continer-outer-shadow);
		font-size: var(--font-size-normal);
	}

	actions-subheader {
		display: flex;
		align-items: center;
		gap: 0.5rem;
		width: 100%;
		flex-wrap: wrap;
	}

	actions-subheader svg {
		width: 1.5rem;
		height: 1.5rem;
	}

	/* min-height, not height, for the same reason equipment-item was changed: a card renders a title, two
	   pills, a description of whatever length was written and an instructions trigger, so a fixed box
	   either clips the fuller ones or spills them over the card below. */
	action-item {
		display: flex;
		flex-direction: column;
		gap: 0.25rem;
		width: 100%;
		border-radius: 1rem;
		background: var(--blue-gray);
		box-shadow: var(--soft-continer-outer-shadow);
		backdrop-filter: blur(11px);
		-webkit-backdrop-filter: blur(11px);
		padding: 1rem;
		min-height: 12rem;
		transition: all 0.3s ease-in-out;
	}

	/* Pushes the instructions trigger to the bottom edge so cards of differing description length still
	   line their triggers up across a row. */
	action-item sl-dropdown {
		margin-top: auto;
	}

	actions-category-pill {
		text-transform: uppercase;
		font-size: var(--font-size-small);
		background-color: var(--background-white);
		padding: 0.25rem 0.5rem;
		border-radius: 0.5rem;
		align-content: center;
	}

	actions-category-pill[colour="red"] {
		background-color: var(--danger-red);
	}
	actions-category-pill[colour="blue"] {
		background-color: var(--link-blue);
	}
	actions-category-pill[colour="green"] {
		background-color: var(--success-green);
	}
	actions-category-pill[colour="orange"] {
		background-color: var(--orange);
	}
	actions-category-pill[colour="purple"] {
		background-color: var(--purple);
	}

	/* Names the facility being viewed beside the page title. Deliberately quieter than the h2 next to it -
	   it qualifies the title rather than competing with it, and every tab below already belongs to this
	   facility. Sits in .supply-item-title's flex row, so no margin of its own is needed. */
	facility-name-pill {
		font-size: var(--font-size-small);
		background-color: var(--background-white);
		border: 1px solid var(--border-color);
		padding: 0.25rem 0.75rem;
		border-radius: 0.5rem;
		align-content: center;
	}

	action-item h4 {
		font-size: var(--font-size-large);
	}

	/* A row's name sits on a line with pills and a badge, so it takes the body scale rather than the display
	   one a card gave it - at large it was the only thing on the row with any weight and the fleet beside it
	   disappeared. */
	equipment-row h4 {
		font-size: var(--font-size-normal);
		font-weight: 650;
        margin: 0;
	}

	/* Panel for the click-triggered dropdown that previews an action's markdown instructions (see
	   ActionCard.cshtml). Sized and scrolled on its own, since the panel floats via sl-dropdown's popup
	   rather than participating in the card's layout. */
	instructions-preview {
		display: block;
		width: 20rem;
		max-width: calc(100vw - 2rem);
		max-height: 16rem;
		overflow-y: auto;
		padding: 0.75rem 1rem;
		border-radius: 0.75rem;
		background: var(--background-white);
		box-shadow: var(--continer-outer-shadow);
		border: 1px solid var(--border-color);
		font-size: var(--font-size-small);
		line-height: 1.5;
	}

	instructions-preview > *:first-child {
		margin-top: 0;
	}

	instructions-preview > *:last-child {
		margin-bottom: 0;
	}

	instructions-preview p {
		margin: 0 0 0.6rem;
	}

	instructions-preview h1,
	instructions-preview h2,
	instructions-preview h3 {
		margin: 0.75rem 0 0.4rem;
		font-weight: 650;
		line-height: 1.3;
	}

	instructions-preview h1 { font-size: var(--font-size-large); }
	instructions-preview h2 { font-size: var(--font-size-medium); }
	instructions-preview h3 { font-size: var(--font-size-normal); }

	instructions-preview ul,
	instructions-preview ol {
		margin: 0 0 0.6rem;
		padding-left: 1.25rem;
	}

	instructions-preview li {
		margin-bottom: 0.15rem;
	}

	instructions-preview blockquote {
		margin: 0 0 0.6rem;
		padding-left: 0.75rem;
		border-left: 3px solid var(--primary-green);
		color: var(--light-global-font-color);
	}

	instructions-preview a {
		color: var(--link-blue);
		text-decoration: underline;
	}

	/* Dashboard Styles */
	maintenance-dashboard {
		display: flex;
		flex-direction: column;
		gap: 2rem;
		padding: 1.5rem;
		height: 100%;
		overflow-y: auto;
	}

	dashboard-row {
		display: grid;
		gap: 2rem;
		width: 100%;
	}

	dashboard-row.top-metrics {
		grid-template-columns: repeat(3, 1fr);
	}

	dashboard-row.secondary-metrics {
		grid-template-columns: repeat(3, 1fr);
	}

	dashboard-row.bottom-section {
		grid-template-columns: 1fr 1fr;
	}

	/* Metric Cards */
	metric-card {
		background: var(--blue-gray);
		box-shadow: var(--soft-continer-outer-shadow);
		border-radius: 1rem;
		padding: 1.5rem;
		transition: all 0.3s ease-in-out;
		display: flex;
		flex-direction: column;
		gap: 0.5rem;
	}

	metric-header {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		margin-bottom: 0.5rem;
	}

	metric-icon svg {
		width: 1.5rem;
		height: 1.5rem;
		opacity: 0.7;
	}

	/* Sentence case at body size. These were tracked-out capitals in the lightest ink on the page, which is
	   the least legible way to set the only text saying what each number is. */
	metric-title {
		font-size: var(--font-size-normal);
		color: var(--light-global-font-color);
		font-weight: 600;
	}

	metric-value {
		font-size: 2.5rem;
		font-weight: 700;
		color: var(--global-font-color);
		line-height: 1;
		font-variant-numeric: tabular-nums;
	}

	/* Trouble is carried on the figure itself rather than by shrinking it into a pill. Schedule compliance
	   used to be the one card in the row rendered as a small coloured pill while every other card showed a
	   2.5rem number - so the figure that most deserves to be seen was the hardest one to see. Only the
	   states worth acting on take colour; a healthy figure stays in the page's own ink. */
	metric-value.metric-state-2 {
		color: var(--orange);
	}

	metric-value.metric-state-3 {
		color: var(--red, #d9534f);
	}

	metric-subtitle {
		font-size: var(--font-size-small);
		color: var(--light-text);
	}

	/* Approval Status Grid */
	approval-status-grid {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 1rem;
	}

	approval-status-item {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		border-radius: 0.5rem;
		transition: all 0.2s ease-in-out;
	}
	

	approval-status-label {
		font-size: var(--font-size-small);
		color: var(--light-global-font-color);
		margin-bottom: 0.25rem;
		font-weight: 500;
	}

	approval-status-value {
		font-size: 2rem;
		font-weight: 700;
		color: var(--global-font-color);
	}

	approval-status-percentage {
		font-size: var(--font-size-small);
		color: var(--light-text);
		margin-top: 0.25rem;
		margin-bottom: 0.5rem;
	}

	approval-status-item.approved approval-status-value {
		color: var(--success-green);
	}

	approval-status-item.pending approval-status-value {
		color: var(--orange);
	}

	approval-status-item.denied approval-status-value {
		color: var(--danger-red);
	}

	/* Single stacked progress bar for approval status */
	approval-status-progress-bar {
		display: flex;
		width: 80%;
		height: 0.5rem;
		background-color: var(--border-color);
		border-radius: 0.5rem;
		overflow: hidden;
		margin-top: 0.5rem;
		align-self: center;
	}

	approval-progress-segment {
		height: 100%;
		transition: width 0.3s ease;
	}

	approval-progress-segment.approved {
		background: var(--success-green);
	}

	approval-progress-segment.pending {
		background: var(--orange);
	}

	approval-progress-segment.denied {
		background: var(--danger-red);
	}

	/* Dashboard Widgets */
	dashboard-widget {
		background: var(--blue-gray);
		box-shadow: var(--soft-continer-outer-shadow);
		border-radius: 1rem;
		padding: 1.5rem;
		display: flex;
		flex-direction: column;
		gap: 1rem;
	}

	widget-header {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		padding-bottom: 0.5rem;
		border-bottom: 1px solid var(--border-color);
	}

	widget-icon svg {
		width: 1.25rem;
		height: 1.25rem;
		opacity: 0.7;
	}

	widget-title {
		font-size: var(--font-size-medium);
		font-weight: 600;
		color: var(--global-font-color);
	}

	/* Status Lists */
	trends-list {
		display: flex;
		flex-direction: column;
		gap: 0.75rem;
	}

	trend-item {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		padding: 0.5rem 0;
		min-height: 30px;
	}

	/* Trends */
	trend-label {
		font-size: var(--font-size-small);
		color: var(--light-global-font-color);
		min-width: 10rem;
	}

	trend-value {
		font-size: 1.5rem;
		font-weight: 700;
		color: var(--global-font-color);
		min-width: 5rem;
	}

	trend-subtitle {
		font-size: var(--font-size-small);
		color: var(--light-text);
		flex: 1;
	}

	/* Equipment Performance */
	/* Was 12.5rem, which at this root size is three rows: the one panel on the dashboard that lists things
	   to go and do was a letterbox with its own scrollbar while the panel beside it ran to twice the height.
	   Deep enough for eight now, which covers the usual day, and still scrolls past that. */
	equipment-performance-list {
		display: flex;
		flex-direction: column;
		gap: 0.75rem;
		overflow-y: auto;
		max-height: 28rem;
		padding: 0 1rem;
	}

	equipment-performance-item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0.75rem 0;
		border-bottom: 1px solid var(--border-color);
	}

	equipment-performance-item:last-child {
		border-bottom: none;
	}

	equipment-info {
		display: flex;
		flex-direction: column;
		gap: 0.25rem;
		flex: 1;
	}

	equipment-name {
		font-size: var(--font-size-normal);
		font-weight: 600;
		color: var(--global-font-color);
	}

	equipment-status {
		font-size: var(--font-size-small);
		color: var(--light-text);
	}

	equipment-indicator {
		display: flex;
		align-items: center;
		margin-left: 1rem;
	}

	attention-triangle {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 1.5rem;
		height: 1.5rem;
		color: var(--orange);
	}

	attention-triangle svg {
		width: 1rem;
		height: 1rem;
	}

	/* Responsive Design */
	@media (max-width: 1200px) {
		dashboard-row.top-metrics {
			grid-template-columns: repeat(2, 1fr);
		}

		dashboard-row.secondary-metrics {
			grid-template-columns: repeat(2, 1fr);
		}
	}

	@media (max-width: 768px) {
		dashboard-row.top-metrics,
		dashboard-row.secondary-metrics,
		dashboard-row.bottom-section {
			grid-template-columns: 1fr;
		}

		metric-value {
			font-size: 2rem;
		}
	}
}


/* The count sits inside the speech-bubble outline rather than beside it, so the badge has to be the
   positioning context for the absolutely placed icon - it never was, which left the icon resolving against
   whatever ancestor happened to be positioned. At file scope because unit cards render this badge on the
   equipment details page, outside the tab group these rules used to be nested inside. */
comments-badge {
	--comments-badge-size: 2rem;
	position: relative;
	display: inline-block;
	width: var(--comments-badge-size);
	height: var(--comments-badge-size);
}

comments-badge sl-icon {
	position: absolute;
	top: 0;
	left: 0;
	width: calc(var(--comments-badge-size) - 0.25rem);
	height: calc(var(--comments-badge-size) - 0.25rem);
}

comments-badge span {
	position: relative;
	display: inline-block;
	width: 90%;
	height: calc(var(--comments-badge-size) - 0.75rem);
	text-align: center;
	align-content: center;
	font-size: var(--font-size-small);
}

/* Equipment Notes Section */
/* Scrolls with whatever holds it - equipment-details-side on the page, .unit-modal-side in the unit
   modal - rather than trapping the wheel in a 50vh box inside an already scrolling column. */
equipment-notes-list {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	overflow-x: hidden;
	padding-right: 0.5rem;
	padding-top: 0.25rem;
}

equipment-notes-list::-webkit-scrollbar {
	width: 6px;
}

equipment-notes-list::-webkit-scrollbar-track {
	background: transparent;
}

equipment-notes-list::-webkit-scrollbar-thumb {
	background: var(--border-color);
	border-radius: 3px;
}

equipment-notes-list::-webkit-scrollbar-thumb:hover {
	background: var(--light-text);
}

.equipment-note-card {
	background: var(--glass-background);
	border: 1px solid var(--border-color);
	border-radius: 0.75rem;
	padding: 1rem;
	transition: all 0.2s ease-in-out;
	box-shadow: var(--soft-glass-container-shadow);
	backdrop-filter: blur(11px);
	-webkit-backdrop-filter: blur(11px);
}

.equipment-note-card:hover {
	border-color: var(--primary-green);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
}

note-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 0.75rem;
	gap: 0.5rem;
}

note-meta {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	flex: 1;
}

note-author {
	font-size: var(--font-size-small);
	font-weight: 600;
	color: var(--global-font-color);
}

note-timestamp {
	font-size: var(--font-size-small);
	color: var(--light-text);
	opacity: 0.8;
}

note-actions {
	display: flex;
	gap: 0.25rem;
	flex-shrink: 0;
}

.equipment-note-card sl-icon-button::part(base) {
	color: var(--light-text);
	transition: all 0.2s ease;
}

.equipment-note-card sl-icon-button::part(base):hover {
	color: var(--danger-red);
	background-color: rgba(220, 53, 69, 0.1);
}

note-content {
	font-size: var(--font-size-normal);
	color: var(--global-font-color);
	line-height: 1.5;
	white-space: pre-wrap;
	word-wrap: break-word;
	margin: 0;
}

/* Add Note Form */
add-note-form {
	display: block;
	background: var(--glass-background);
	border: 1px solid var(--border-color);
	border-radius: 0.75rem;
	padding: 1rem;
	margin-bottom: 1rem;
	box-shadow: var(--soft-glass-container-shadow);
	backdrop-filter: blur(11px);
	-webkit-backdrop-filter: blur(11px);
	animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

add-note-form form-field {
	margin-bottom: 0.75rem;
}

add-note-form form-field label {
	font-size: var(--font-size-small);
	font-weight: 600;
	color: var(--global-font-color);
	margin-bottom: 0.5rem;
	display: block;
}

add-note-form sl-textarea::part(base) {
	border-color: var(--border-color);
}

add-note-form sl-textarea::part(base):focus-within {
	border-color: var(--primary-green);
	box-shadow: 0 0 0 3px rgba(66, 184, 131, 0.1);
}

note-form-actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
	margin-top: 0.75rem;
}

/* Empty State */
notes-empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 3rem 1rem;
	text-align: center;
	color: var(--light-text);
}

/* The empty state is always in the list and yields to whatever cards are in it. Notes arrive and leave as
   single-card swaps (afterbegin on add, outerHTML on delete), so the list's own contents are the only thing
   that knows whether it is empty - a server-rendered if/else would describe the page load and nothing after. */
equipment-notes-list:has(.equipment-note-card) notes-empty-state {
	display: none;
}

notes-empty-state p {
	font-size: var(--font-size-normal);
	margin: 0;
	opacity: 0.7;
}

/* Maintenance Line Items Section (mirrors the Equipment Notes styles above) */
maintenance-line-items-readonly {
	display: flex;
	flex-direction: row;
	gap: 0.75rem;
	overflow-y: auto;
	overflow-x: hidden;
	padding-right: 0.5rem;
	padding-top: 0.25rem;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
}

/* Top level rather than nested under maintenance-management like the action card that also uses it: the pill
   is rendered by MaintenanceLineItemRow inside the record modal, which lives in #mainModal at body level and
   so is outside that scope - nested there, a timed line read as bare text with a clock beside it. */
time-pill {
	font-size: var(--font-size-small);
	background-color: var(--background-white);
	border: 1px solid var(--border-color);
	padding: 0.25rem 0.5rem;
	align-items: center;
	display: flex;
	gap: 0.25rem;
	border-radius: 0.5rem;
	/* "4 min" is one token; inside a 15rem pass card it was breaking between the number and the unit. */
	white-space: nowrap;
}

.maintenance-line-item-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	background: var(--glass-background);
	border: 1px solid var(--border-color);
	border-radius: 0.75rem;
	padding: 1rem;
	transition: all 0.2s ease-in-out;
	box-shadow: var(--soft-glass-container-shadow);
	backdrop-filter: blur(11px);
	-webkit-backdrop-filter: blur(11px);
    width: 15rem;
}

.maintenance-line-item-card:hover {
	border-color: var(--primary-green);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
}

line-item-info {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	flex: 1;
}

line-item-equipment {
	font-size: var(--font-size-small);
	font-weight: 600;
	color: var(--global-font-color);
}

line-item-action {
	font-size: var(--font-size-small);
	color: var(--light-text);
}

.maintenance-line-item-card sl-icon-button::part(base) {
	color: var(--light-text);
	transition: all 0.2s ease;
}

.maintenance-line-item-card sl-icon-button::part(base):hover {
	color: var(--danger-red);
	background-color: rgba(220, 53, 69, 0.1);
}

/* The small explanatory line under a form field. It was first written for the equipment form's Compatible
   Actions checklist, withdrawn on 2026-10-07; the hint style stayed because the module's other forms use it. */
.field-hint {
	font-size: var(--font-size-small);
	color: var(--light-text);
	margin: 0 0 0.5rem 0;
}

/* ==========================================================================
   Maintenance overhaul: equipment browser, units, rounds, work requests and
   the multi-asset entry screens.
   ========================================================================== */

/* --- Equipment browser -------------------------------------------------- */

equipment-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	padding: 0.25rem 0 1rem 0;
}

equipment-toolbar .equipment-search {
	flex: 1 1 18rem;
	min-width: 14rem;
}

equipment-toolbar .equipment-filter {
	flex: 0 1 11rem;
	min-width: 9rem;
}

equipment-result-count {
	margin-left: auto;
	font-size: var(--font-size-small);
	white-space: nowrap;
}

/* One list per category group.
 *
 * This was a grid of cards, and at this facility's shape - twenty categories holding one or two records each
 * - it produced a column of near-empty cards with a screen's width of nothing beside each. Equipment records
 * are all the same shape: a name, where it is, how much of the fleet is working. That is a roster, and a
 * roster is rows. The width the cards wasted is what the fleet strip now spends. */
equipment-rows {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	width: 100%;
	padding: 0.4rem 0 1.25rem 0;
}

equipment-row {
	display: grid;
	grid-template-columns: minmax(12rem, 1fr) auto minmax(7rem, auto) 1.25rem;
	align-items: center;
	gap: 1.25rem;
	padding: 0.7rem 0.9rem;
	border: 1px solid transparent;
	cursor: pointer;
	transition: border-color 0.1s ease-in-out;
}

equipment-row:hover {
	border-color: var(--border-color);
}

equipment-row:focus-visible {
	outline: 2px solid var(--darker-primary-green);
	outline-offset: 2px;
}

equipment-identity {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
}

equipment-meta {
	display: block;
	min-width: 0;
}

equipment-fleet {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.3rem;
	min-width: 0;
}

/* The fleet strip: one segment per unit, in fleet order.
 *
 * "50 units, 2 need attention" states how much of a fleet is down; it does not let you see it, and it reads
 * identically whether two lights are out or twenty. Drawn, the same fact is read without counting - and the
 * strip grows with the fleet, so a big fleet looks like one.
 *
 * A grid over a column count the view sets, not a flex line: fr tracks divide whatever width the strip has,
 * so segments cannot spill out of it however many units there are, and the rows come for free once the
 * columns run out. The flex version could spill and did - it had no wrap and a 2px floor per segment, so a
 * 500-unit fleet drew a 2000px line back across the equipment's name.
 *
 * The width cap is the other half of that: 8px per column is the 6px segment the old ceiling allowed plus
 * its gap, so a small fleet keeps its ticks the size they always were and stops growing the track once the
 * fleet would fill 13rem, at which point the tracks divide that instead. Because the track is only as wide
 * as the fleet needs, it is equipment-fleet's alignment that puts the strip against the right-hand edge -
 * there is no spare width inside the strip left to justify. */
fleet-strip {
	display: grid;
	grid-template-columns: repeat(var(--fleet-columns, 1), minmax(0, 1fr));
	gap: 2px;
	width: min(13rem, calc(var(--fleet-columns, 1) * 8px - 2px));
	max-width: 100%;
}

fleet-unit {
	display: block;
	height: 14px;
	border-radius: 1px;
	background: var(--success-green);
}

/* Past the size where one segment per unit can be drawn at all (EquipmentCard.cshtml decides where that is),
   the strip becomes one slice per status, each grown by the number of units holding it. Five hundred
   sub-pixel ticks carry nothing their own proportions do not, and the proportions survive at any width.
   The floor keeps a two-in-five-hundred slice on screen: the bigger the fleet, the easier a couple of dead
   units is to lose, which is exactly when they most need to be visible. */
fleet-strip.fleet-strip-proportional {
	display: flex;
	width: 13rem;
}

fleet-strip.fleet-strip-proportional fleet-unit {
	flex: 0 1 auto;
	min-width: 4px;
}

/* Keyed off the same 0-3 variant the status pill uses, so a unit's segment and its pill can never disagree
   about what colour its state is. */
fleet-unit[data-variant="0"] { background: var(--border-color); }
fleet-unit[data-variant="2"] { background: var(--orange); }
fleet-unit[data-variant="3"] { background: var(--red, #d9534f); }

.equipment-row-chevron {
	color: var(--light-text);
	font-size: 1rem;
}

.equipment-category-group[hidden] {
	display: none;
}

/* A quiet heading rather than a tracked-out all-caps label: it names a group of rows rather than announcing
   itself, and small text in capitals is the least legible thing on the page. */
.equipment-category-summary {
	display: inline-flex;
	align-items: baseline;
	gap: 0.6rem;
	font-size: var(--font-size-normal);
	font-weight: 650;
	color: var(--global-font-color);
}

@media (max-width: 1000px) {
	equipment-row {
		grid-template-columns: minmax(0, 1fr) auto;
		gap: 0.5rem 1rem;
	}

	/* The fleet and the status pill pair up on a second line rather than each taking a column too narrow to
	   hold them. */
	equipment-fleet {
		grid-column: 1;
		align-items: flex-start;
	}

	.equipment-row-chevron {
		display: none;
	}
}

criticality-pill,
round-code,
unit-code {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	padding: 0.15rem 0.55rem;
	border-radius: 0.75rem;
	font-size: var(--font-size-small);
	background: var(--background-white);
	border: 1px solid var(--border-color);
	color: var(--light-text);
	white-space: nowrap;
}

/* The printed asset tag is monospaced so a code being read off a machine can be matched character by
   character - O versus 0 matters when someone is typing it in as a scanner fallback. */
unit-code,
round-code {
	font-family: monospace;
	letter-spacing: 0.03rem;
}

.unit-attention {
	color: var(--red, #d9534f);
	font-weight: 600;
}

.warranty-expired {
	color: var(--red, #d9534f);
}

criticality-pill.criticality-high,
criticality-pill.criticality-critical {
	border-color: var(--red, #d9534f);
	color: var(--red, #d9534f);
}

equipment-no-results,
asset-picker-no-results {
	display: block;
	padding: 2rem 1rem;
	text-align: center;
}

equipment-no-results[hidden],
asset-picker-no-results[hidden] {
    display: none;
}

/* --- Equipment details page --------------------------------------------- */

equipment-details-page {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	height: 100%;
	overflow: hidden;
}

equipment-details-body {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 24rem;
	gap: 1.25rem;
	padding: 0 1.5rem 1.5rem 1.5rem;
	overflow: hidden;
	flex: 1;
	min-height: 0;
}

equipment-details-main,
equipment-details-side {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	overflow-y: auto;
	min-height: 0;
	padding: 0.35rem;
}

equipment-panel h3{
    margin: 0;
}

/* Single-column below a laptop width: the two-column split becomes unreadable once the side panel is under
   about 20rem, and the unit list is the part that matters on a small screen.

   This block only covers equipment-details-body. The three take-over screens are collapsed by a second block
   further down, immediately after their own base rules - a media query adds no specificity, so a collapse
   written here would be silently overridden by any `grid-template-columns` declared later in the file. That
   is exactly what used to happen: the entry, builder and walk screens never stacked at any width. Keep each
   collapse below the rule it overrides. */
@media (max-width: 1180px) {
	equipment-details-body {
		grid-template-columns: minmax(0, 1fr);
	}
}

equipment-panel,
entry-panel {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1.25rem;
	border-radius: 1rem;
	background: var(--blue-gray);
	box-shadow: var(--soft-continer-outer-shadow);
}

equipment-panel.danger-panel {
	border: 1px solid var(--border-color);
}

/* Why Delete isn't offered, read after the actions. The panel's own gap spaces it from the buttons, and it takes
   the panel's full width so the sentence wraps to two or three lines rather than a narrow column. The measure
   cap is for the single-column layout below 1180px, where the panel spans the page and the note would otherwise
   run as one long line. */
manage-note {
	display: block;
	max-width: 60ch;
	font-size: var(--font-size-small);
	line-height: 1.45;
	color: var(--light-text);
}

empty-panel-state {
	display: block;
	padding: 1.25rem 0.5rem;
	color: var(--light-text);
	font-size: var(--font-size-small);
}

empty-panel-state p {
	margin: 0;
}

/* --- Units -------------------------------------------------------------- */

/* The units panel's search and status filter, shown only once a fleet outgrows a page (see
   EquipmentUnitListModel.NeedsToolbar). It mirrors equipment-toolbar rather than inventing a second shape for
   the same job, but sits inside a panel rather than above a page, so it carries the panel's top rule instead
   of the page's bottom padding. */
unit-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin-top: 0.75rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--border-color);
}

unit-toolbar .unit-search {
	flex: 1 1 16rem;
	min-width: 12rem;
}

unit-toolbar .unit-filter {
	flex: 0 1 11rem;
	min-width: 9rem;
}

unit-results {
	display: block;
}

/* "Showing 50 of 500 units" is the only thing on the page that says the list above it is partial, so the
   pager is always drawn once a fleet exceeds one page - even on the last one, where there is nothing left to
   load and only the count to state. */
unit-pager {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.75rem;
	padding-top: 0.9rem;
}

unit-list {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	padding-top: 0.5rem;
}

unit-card {
	display: block;
	padding: 0.75rem 1rem;
	border-radius: 0.75rem;
	background: var(--background-white);
	border: 1px solid var(--border-color);
	transition: border-color 0.1s ease-in-out;
}

unit-card.unit-archived {
	opacity: 0.55;
}

status-history-list,
unit-history-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

status-history-item,
unit-history-item {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	padding: 0.6rem 0.75rem;
	border-radius: 0.6rem;
	background: var(--background-white);
	border: 1px solid var(--border-color);
}

.unit-modal-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 22rem;
	gap: 1.5rem;
}

.unit-modal-side {
	border-left: 1px solid var(--border-color);
	padding-left: 1.5rem;
	overflow-y: auto;
}

@media (max-width: 1100px) {
	.unit-modal-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.unit-modal-side {
		border-left: none;
		padding-left: 0;
		border-top: 1px solid var(--border-color);
		padding-top: 1rem;
	}
}

/* --- Multi-asset entry, round builder, round checklist ------------------ */

/* A bounded pane, so the columns inside can scroll and the action bar can sit still.
 *
 * These pages were written as app-shell panes - a height from the shell, two columns scrolling inside
 * themselves, the submit button always on screen - but the shell hands out no height: `body` is
 * `min-height: 100dvh`, `#body` and `main` are `flex: 1`, so every one of them grows to its content and
 * `height: 100%` resolved to auto. The columns' `overflow: auto` therefore never engaged, the document
 * scrolled instead, and the submit button rode away with it: on a 55-stop round it ended up 3,500 pixels
 * above the end of the list, so finishing a walk meant scrolling the whole walk back.
 *
 * The height is taken from the viewport the way the other framed panes in this codebase take theirs (see
 * facilities.css) - main's own top margin is the window header, and the 1rem covers its bottom padding.
 *
 * Equipment details is deliberately not in this list: it is a document to read top to bottom, not a working
 * surface with a control that has to stay put, and it scrolls with the page correctly as it is. */
maintenance-entry-page,
round-builder-page,
round-run-page {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	height: calc(100dvh - var(--window-header-height));
	overflow: hidden;
}

equipment-details-page {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	min-height: 100%;
}

/* All three of these screens wrap their body in a form, and the global `form` rule gives it no layout of its
   own - so the body above the action bar had nothing to resolve its flex against, and both sized to their
   content instead of sharing the pane. */
maintenance-entry-page > form,
round-builder-page > form,
round-run-page > form {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
}

/* The title, the columns and the action bar share one measure and one gutter, so the round's name, the
   first stop and the button that finishes the walk all start on the same vertical line. The bar keeps its
   rule full-bleed and insets only its contents, because a hairline that stops short of the edges reads as a
   box someone forgot to finish. */
maintenance-entry-page > .page-header,
round-builder-page > .page-header,
round-run-page > .page-header,
maintenance-action-bar {
	padding-inline: max(1.5rem, calc((100% - 88rem) / 2 + 1.5rem));
}

/* Capped and centred, the way Cleaning's walk column is.
 *
 * Left to fill a 1400px window, a stop row put the asset's name at the far left and the thing you press at
 * the far right with a hand's width of nothing between them - fifty-five times down a list. A measure keeps
 * the name and its control in one glance. */
maintenance-entry-body,
round-builder-body,
round-run-body {
	width: 100%;
	max-width: 88rem;
	margin-inline: auto;
}

maintenance-entry-body,
round-builder-body {
	display: grid;
	grid-template-columns: 24rem minmax(0, 1fr);
	gap: 1.5rem;
	padding: 0 1.5rem 0.5rem 1.5rem;
	overflow: hidden;
	flex: 1;
	/* Lets the grid row shrink below its content so the columns inside can take over the scrolling. */
	min-height: 0;
}

/* The checklist is the substance of the walk screen, so it takes the wide column and the session fields sit
   beside it - the reverse of the entry screen, where the picker is the wide one. */
round-run-body {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 24rem;
	gap: 1.5rem;
	padding: 0 1.5rem 0.5rem 1.5rem;
	overflow: hidden;
	flex: 1;
	min-height: 0;
}

/* The three take-over screens collapse at the same width as the equipment details page. This has to sit
   below their base rules rather than beside the equipment one - see the note on that media block. */
@media (max-width: 1180px) {
	maintenance-entry-body,
	round-builder-body,
	round-run-body {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Stacked, the session fields would otherwise sit above the picker and push it a screen down - and a
	   tablet is the device these screens are used on. The session details are filled in once; ticking the
	   assets is the work, so it leads. round-run-body already has the checklist first in the DOM. */
	maintenance-entry-side,
	round-builder-side {
		order: 2;
	}

	/* Stacked, the two regions are one column of content, so the scrolling moves up to the body they share -
	   two scrollers stacked means the wheel stops working halfway down the page. */
	maintenance-entry-body,
	round-builder-body,
	round-run-body {
		overflow-y: auto;
	}

	maintenance-entry-side,
	maintenance-entry-main,
	round-builder-side,
	round-builder-main,
	round-run-side,
	round-run-main {
		overflow: visible;
	}
}

maintenance-entry-side,
maintenance-entry-main,
round-builder-side,
round-builder-main,
round-run-side,
round-run-main {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	overflow-y: auto;
	min-height: 0;
	padding: 0.5rem;
}

/* The bar that finishes the screen. Not sticky and not fixed - it is the last row of a pane with a height,
   so it is simply always there, with the columns above it doing the scrolling.
 *
 * The running count travels with the button because it is the number somebody checks in the second before
 * committing, and it used to be off-screen at exactly that moment. */
maintenance-action-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	flex: 0 0 auto;
	flex-wrap: wrap;
	padding-block: 0.8rem;
	border-top: 1px solid var(--border-color);
	background: var(--background-white);
}

action-bar-summary {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
	/* The caveat beside the button is a sentence, not a paragraph - past this measure it wraps into a block
	   that pushes the bar tall enough to eat the list above it. */
	max-width: 52rem;
}

maintenance-action-bar .field-hint {
	margin: 0;
}

maintenance-action-bar nb-button {
	flex: 0 0 auto;
}

@media (max-width: 700px) {
	maintenance-action-bar {
		flex-direction: column;
		align-items: stretch;
		gap: 0.6rem;
	}
}

/* In the action bar this is the line stating what is about to be recorded, so it is set in readable ink
   rather than the lightest grey available - it was previously a hint in a side panel, where being quiet was
   the right call. */
selected-count,
checklist-summary,
checklist-progress {
	display: block;
	font-size: var(--font-size-normal);
	color: var(--light-global-font-color);
	font-variant-numeric: tabular-nums;
}

selected-count.has-selection,
checklist-summary.has-exceptions {
	color: var(--global-font-color);
	font-weight: 600;
}

asset-picker-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
	padding: 0.25rem 0 0.75rem 0;
}

asset-picker-toolbar sl-input {
	flex: 1 1 16rem;
	min-width: 12rem;
}

asset-picker-toolbar sl-select {
	flex: 0 1 11rem;
	min-width: 9rem;
}

/* No scroller of its own: maintenance-entry-main and round-builder-main already scroll, and a list that
   scrolls inside a scrolling column means the wheel never reaches the column under the pointer. */
asset-picker {
	display: block;
}

.asset-picker-group[hidden] {
	display: none;
}

.asset-group-summary {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	font-size: var(--font-size-normal);
	font-weight: 650;
	color: var(--global-font-color);
}

asset-rows {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

asset-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.5rem 0.75rem;
	border-radius: 0.6rem;
	border: 1px solid transparent;
	transition: background 0.1s ease-in-out;
}

asset-row[hidden] {
	display: none;
}

asset-row:hover {
	background: var(--background-white);
}

/* The whole row is the click target, not just the checkbox - a 16px box is an unreasonable thing to aim at
   fifty times in a row, especially on a tablet. */
.asset-row-label {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex: 1;
	min-width: 0;
	cursor: pointer;
}

.asset-row-name {
	font-size: var(--font-size-normal);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.asset-optional-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: var(--font-size-small);
	color: var(--light-text);
	cursor: pointer;
	white-space: nowrap;
	transition: opacity 0.1s ease-in-out;
}

/* Optional applies to stops that are on the round, so the toggle recedes until its row is ticked. */
asset-row.row-unselected .asset-optional-toggle {
	opacity: 0.4;
}

/* --- Round checklist filters ------------------------------------------- */

/* The quick filter bar.
 *
 * A recessed strip at the top of the checklist panel: a heading row saying what the control does and what it
 * is currently doing, then one row per axis. Deliberately flat - the first attempt nested a track inside a
 * bar inside a panel, and in the dark theme three surfaces three percent apart in lightness read as one
 * muddy box with some text floating in it. What needs contrast here is a chip's state, so that is where the
 * contrast is spent and nowhere else.
 *
 * The rows are separated by a hairline rather than by boxes, which is the same way the printed documents
 * separate their sections and for the same reason: a rule costs nothing and a box costs a surface. */
checklist-filters {
	display: flex;
	flex-direction: column;
	padding: 0.7rem 0.9rem 0.4rem;
	border-radius: 0.75rem;
	background: var(--deep-background-color);
	border: 1px solid var(--border-color);
}

filter-bar-head {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding-bottom: 0.5rem;
	min-height: 1.6rem;
}

/* Sentence case. These name the rows of the filter rail, and tracked-out capitals in the lightest ink is the
   least legible way to set a label somebody has to read while standing in a grow room. */
filter-bar-title,
filter-group-label {
	font-size: var(--font-size-small);
	font-weight: 600;
	color: var(--light-global-font-color);
}

/* Pushed to the far end of the heading row, so what the filter is doing is read in the same glance as its
   name rather than being found under three rows of chips. */
checklist-filter-summary {
	display: block;
	margin-left: auto;
	font-size: var(--font-size-small);
	color: var(--global-font-color);
}

.checklist-filter-clear {
	padding: 0.2rem 0.65rem;
	border: 1px solid var(--border-color);
	border-radius: 999px;
	background: transparent;
	font-family: var(--global-font-family);
	font-size: var(--font-size-small);
	color: var(--light-global-font-color);
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.checklist-filter-clear:hover {
	color: var(--global-font-color);
	border-color: var(--light-global-font-color);
}

filter-group {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.35rem 0;
}

/* A hairline between axes rather than a box around each: enough to say the rows are separate questions,
   quiet enough that the chips stay the loudest thing in the bar. */
filter-group + filter-group {
	border-top: 1px solid var(--border-color);
}

/* A fixed measure so the three rows of chips start on the same vertical line - without it each row is
   indented by the length of its own word and the bar reads as three unrelated controls. */
filter-group-label {
	flex: 1;
}

filter-track {
	display: flex;
	flex: 1 1 auto;
	flex-wrap: wrap;
	gap: 0.3rem;
	min-width: 0;
}

/* Sized for a thumb rather than a pointer: this is pressed mid-walk, one-handed, often in gloves. */
.checklist-filter-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	min-height: 2rem;
	padding: 0.3rem 0.8rem;
	border: 1px solid var(--border-color);
	border-radius: 999px;
	background: transparent;
	font-family: var(--global-font-family);
	font-size: var(--font-size-small);
	color: var(--light-global-font-color);
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.checklist-filter-chip:hover:not([disabled]) {
	color: var(--global-font-color);
	border-color: var(--light-global-font-color);
}

/* The accent, used here for the one thing it means everywhere else in the app: this is the live one. An
   outline rather than a fill, because a filled gold chip is what the OK button on every row below already
   is, and two different meanings in one colour and one shape on one screen is how a walker learns to
   distrust both. */
.checklist-filter-chip[aria-pressed="true"] {
	background: var(--background-white);
	border-color: var(--darker-primary-green);
	color: var(--global-font-color);
	font-weight: 600;
}

/* "All" is the absence of a choice, so it is marked but never accented. Otherwise every row wears a gold
   ring at rest, and the accent stops meaning "you have narrowed this" the moment the bar is opened. */
.checklist-filter-chip[aria-pressed="true"][data-value=""] {
	border-color: var(--border-color);
	color: var(--light-global-font-color);
}

/* A chip whose count has fallen to zero under the other filters. Faded and inert rather than removed:
   which combinations are empty is information, and a rail that reshuffles itself on every press cannot be
   aimed at. */
.checklist-filter-chip[disabled] {
	opacity: 0.35;
	cursor: default;
}

.checklist-filter-chip:focus-visible {
	outline: 2px solid var(--darker-primary-green);
	outline-offset: 2px;
}

/* How many stops the chip is worth under whatever else is filtered - see refreshChipCounts. Divided off by
   a rule rather than set in a pill of its own: at this size a pill inside a pill is two borders and no
   extra meaning, and the number only has to read as belonging to the name beside it. */
chip-count {
	padding-left: 0.45rem;
	border-left: 1px solid var(--border-color);
	font-size: var(--font-size-small);
	font-weight: 400;
	color: var(--light-global-font-color);
}

.checklist-filter-chip[aria-pressed="true"]:not([data-value=""]) chip-count {
	border-left-color: var(--darker-primary-green);
	color: var(--global-font-color);
}

checklist-no-matches {
	display: block;
	padding: 1.5rem 1rem;
	text-align: center;
	font-size: var(--font-size-small);
	color: var(--light-global-font-color);
}

@media (max-width: 900px) {
	/* The axis name takes a line of its own and its chips scroll sideways under it. At this width a 5rem
	   gutter leaves room for about one and a half chips, and wrapping three axes into nine lines pushes the
	   first stop off the screen - which is the row somebody is standing in front of. */
	filter-group {
		flex-wrap: wrap;
		gap: 0.3rem;
	}

	filter-group-label {
		flex-basis: 100%;
	}

	filter-track {
		flex-wrap: nowrap;
		overflow-x: auto;
	}

	.checklist-filter-chip {
		white-space: nowrap;
	}
}

/* --- Round checklist rows ---------------------------------------------- */

/* Scrolls with round-run-main rather than inside it - see asset-picker. */
checklist-rows {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding-top: 0.5rem;
}

checklist-row {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	border-radius: 0.75rem;
	background: var(--background-white);
	border: 1px solid var(--border-color);
	transition: opacity 0.1s ease-in-out, border-color 0.1s ease-in-out;
}

/* A skipped row fades rather than disappearing: the walker needs to see what they chose not to check. */
checklist-row.row-excluded {
	opacity: 0.45;
}

checklist-row.row-exception {
	border-color: var(--gold, #d0a215);
}

checklist-row-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
}

.checklist-include {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex: 1;
	min-width: 14rem;
	cursor: pointer;
}

checklist-outcome .outcome-group::part(button-group) {
	flex-wrap: nowrap;
}

.checklist-exception[hidden],
.checklist-duration[hidden] {
	display: none;
}

.checklist-exception,
.checklist-duration {
	display: block;
	padding-left: 2rem;
}

/* --- Rounds list ------------------------------------------------------- */

/* The section frames. Records and the activity feed joined this rule when the tab group went: they used to
   take their inset from <sl-tab-panel>'s own padding, which no longer exists to give it to them. */
rounds-management,
requests-management,
calendar-management,
records-management,
activity-management {
	display: flex;
	flex-direction: column;
	height: 100%;
	gap: 1rem;
	padding: 1.5rem;
}

rounds-list,
rounds-list-archived,
requests-container {
	display: block;
	width: 100%;
	overflow-y: auto;
}

requests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr));
    gap: 1.25rem;
    width: 100%;
    padding: 0.5rem 0.25rem;
}

request-card {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1.1rem;
	border-radius: 1rem;
	background: var(--blue-gray);
	box-shadow: var(--soft-continer-outer-shadow);
	border: 1px solid transparent;
	cursor: pointer;
	transition: border-color 0.1s ease-in-out;
}

request-card:hover {
	border-color: var(--border-color);
}

request-card:focus-visible {
	outline: 2px solid var(--darker-primary-green);
	outline-offset: 2px;
}

/* Pushed to the bottom edge so who-raised-it and the chevron line up across a row whatever length of
   description each card carries - the cards stretch to the tallest in their row either way. */
.request-card-foot {
	margin-top: auto;
	padding-top: 0.4rem;
}

.request-card-chevron {
	color: var(--light-text);
	font-size: 1rem;
}

/* --- Rounds list --------------------------------------------------------
 *
 * Rows, not cards. A round is an appointment, and four appointments in a card grid could not be compared:
 * each card sized to its own description, so the due state, the history figures and the walk button landed at
 * a different height in every column. Everything worth scanning here is the same shape in every round, which
 * is what a row is for - and it leaves the state a column of its own instead of a pill that wrapped "10
 * day(s) overdue" onto three lines. */
round-rows {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	width: 100%;
	padding: 0.5rem 0.25rem;
}

round-row {
	display: grid;
	grid-template-columns: 8.5rem minmax(12rem, 1fr) auto auto;
	align-items: center;
	gap: 1.25rem;
	padding: 0.9rem 1.1rem 0.9rem 0.85rem;
	border-radius: 1rem;
	background: var(--blue-gray);
	box-shadow: var(--soft-continer-outer-shadow);
	/* The state rail. A left edge rather than a full border: it keys the row to its urgency without boxing
	   it, and because every row carries one at the same width the rails stack into a single readable strip
	   down the left of the list. Transparent by default so an on-schedule round costs no ink. */
	border-left: 4px solid transparent;
}

round-row[data-due-state="overdue"] {
	border-left-color: var(--red, #d9534f);
}

round-row[data-due-state="due"],
round-row[data-due-state="neverperformed"] {
	border-left-color: var(--orange);
}

round-row[data-due-state="scheduled"] {
	border-left-color: var(--success-green);
}

round-due {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
}

/* The word is what gets scanned down the column; the qualifier underneath is read only once the word has
   stopped someone, so it is sized and coloured as the secondary thing it is. */
round-due-state {
	font-weight: 650;
	font-size: var(--font-size-normal);
	line-height: 1.2;
}

round-row[data-due-state="overdue"] round-due-state {
	color: var(--red, #d9534f);
}

round-row[data-due-state="due"] round-due-state,
round-row[data-due-state="neverperformed"] round-due-state {
	color: var(--orange);
}

round-due-detail {
	font-size: var(--font-size-small);
	color: var(--light-text);
	line-height: 1.3;
}

round-identity {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	min-width: 0;
}

round-row-actions {
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

/* One breakpoint, not a cascade of them: below this the four regions cannot sit side by side at a readable
   measure, so the row folds into the same order stacked - state, identity, figures, action. */
@media (max-width: 1100px) {
	round-row {
		grid-template-columns: minmax(0, 1fr);
		align-items: stretch;
		gap: 0.75rem;
	}

	round-row-actions {
		justify-content: flex-start;
	}
}

/* round-description holds rendered markdown (see RoundCard.cshtml), so the card teaser is clamped with
   .truncate-markdown alongside .truncate-2-lines - that utility is what keeps a line clamp working over
   the block elements markdown produces. See utility_classes.css. */
round-description,
.request-description {
	display: block;
	margin: 0;
	font-size: var(--font-size-small);
	color: var(--light-text);
}

round-description a {
	color: var(--link-blue);
	text-decoration: underline;
}

/* Equipment descriptions are markdown too, but unlike a round's they are shown twice: clamped to two
   lines on the card, and in full on the details page. Only the document form is described here - the
   card's copy overrides all of it through .truncate-markdown, so the two never need separate markup. */
equipment-description {
	display: block;
	text-align: left;
	/* The card lays this out as a flex item beside its label; without this the intrinsic width of a long
	   description wins over the clamp and the row grows instead of truncating. */
	min-width: 0;
}

equipment-description > *:first-child {
	margin-top: 0;
}

equipment-description > *:last-child {
	margin-bottom: 0;
}

equipment-description p {
	margin: 0 0 0.5rem;
}

equipment-description :is(h1, h2, h3) {
	margin: 0.6rem 0 0.3rem;
	font-weight: 650;
	line-height: 1.3;
}

/* Deliberately flatter than the editor's own scale: a description sits inside a panel that already has
   an h3 above it, so its headings label paragraphs rather than compete with the page's own hierarchy. */
equipment-description h1 { font-size: var(--font-size-medium); }
equipment-description h2 { font-size: var(--font-size-normal); }
equipment-description h3 { font-size: var(--font-size-normal); }

equipment-description ul,
equipment-description ol {
	margin: 0 0 0.5rem;
	padding-left: 1.25rem;
}

equipment-description li {
	margin-bottom: 0.15rem;
}

/* Scoped away from the clamped copy: the border is a block-level decoration, and on an inline run it
   would draw a stray green tick mid-sentence rather than a quote rule. */
equipment-description:not(.truncate-markdown) blockquote {
	margin: 0 0 0.5rem;
	padding-left: 0.75rem;
	border-left: 3px solid var(--primary-green);
	color: var(--light-global-font-color);
}

equipment-description a {
	color: var(--link-blue);
	text-decoration: underline;
}

/* Two by two rather than the four-across strip a card used. Across a row the four figures would otherwise
   stretch the width of the screen and stop reading as one group; paired, they sit as a block between the
   round's name and its button. */
round-stats {
	display: grid;
	grid-template-columns: repeat(2, minmax(7.5rem, auto));
	gap: 0.3rem 1.5rem;
}

round-stat {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	font-size: var(--font-size-small);
}

/* Tabular figures so the dates and percentages in the second column line up on their own digits rather than
   drifting with the width of each glyph. */
round-stat strong {
	font-variant-numeric: tabular-nums;
}

/* The one figure on the row allowed to change colour: adherence is what says whether the schedule is being
   honoured at all, and a round can read "On schedule" today while having missed a fifth of its walks. */
round-stat strong.stat-poor {
	color: var(--red, #d9534f);
}

round-history-list,
equipment-history-list,
request-mini-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding-top: 0.5rem;
}

round-history-item,
equipment-history-item,
request-mini-item {
	display: block;
	padding: 0.7rem 0.9rem;
	border-radius: 0.7rem;
	background: var(--background-white);
	border: 1px solid var(--border-color);
	cursor: pointer;
	transition: border-color 0.1s ease-in-out;
}

/* A column, so the title can take the full width above the code and the pill rather than sharing a line
   with them. */
request-mini-item {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.request-mini-title {
	font-weight: 600;
	line-height: 1.3;
}

round-history-item:hover,
equipment-history-item:hover,
request-mini-item:hover,
.clickable-attention-item {
	cursor: pointer;
}

round-history-item:hover,
equipment-history-item:hover,
request-mini-item:hover {
	border-color: var(--primary-green, #4a9);
}

exception-note {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding-top: 0.3rem;
	font-size: var(--font-size-small);
}

/* --- Work requests ----------------------------------------------------- */

/* Age drives visual weight, not just the text: a fault reported three weeks ago must not look the same as one
   reported this morning. */
request-card.request-ageing {
	border-left: 3px solid var(--gold, #d0a215);
}

request-card.request-stale {
	border-left: 3px solid var(--red, #d9534f);
}

request-timeline {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

request-timeline-item {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	padding: 0.6rem 0.8rem;
	border-radius: 0.6rem;
	background: var(--background-white);
	border: 1px solid var(--border-color);
}

.request-timeline-comment {
	margin: 0.25rem 0 0 0;
	font-size: var(--font-size-small);
}

/* --- Records list, verification and record view ------------------------ */

bulk-verify-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	margin: 0 0 0.75rem 0;
	padding: 0.8rem 1.1rem;
	border-radius: 0.8rem;
	background: var(--blue-gray);
	border: 1px solid var(--border-color);
}

/* The facts on a record are read, never edited, so they are label/value pairs on the app's .details-field
   pattern rather than readonly inputs. auto-fit so a narrow modal falls to one column without a breakpoint. */
record-facts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	gap: 0.75rem 1.5rem;
	padding: 0.25rem 0 0.5rem 0;
}

record-facts .details-field {
	gap: 0.15rem;
	min-width: 0;
}

record-facts .details-field p {
	font-size: var(--font-size-normal);
	word-break: break-word;
}

/* Free text typed by whoever logged the session, so its line breaks are content - same treatment as
   note-content on the equipment notes. */
record-note {
	display: block;
	padding-top: 0.15rem;
	font-size: var(--font-size-normal);
	line-height: 1.5;
	white-space: pre-wrap;
	word-wrap: break-word;
}

verification-lag {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
	padding-top: 0.6rem;
	font-size: var(--font-size-small);
}

verification-age-note {
	display: block;
	padding-top: 0.5rem;
	font-size: var(--font-size-small);
	color: var(--light-text);
}

/* The archived-unit note in the unit view reads as the same kind of notice, so it shares the look. */
coverage-warning,
archived-unit-note {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin: 0.75rem 0;
	padding: 0.7rem 1rem;
	border-radius: 0.7rem;
	border: 1px solid var(--gold, #d0a215);
	font-size: var(--font-size-small);
}

coverage-warning svg,
archived-unit-note svg {
	width: 1.2rem;
	height: 1.2rem;
	flex-shrink: 0;
}

maintenance-exception-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	/* form-field is a column flex that starts its children rather than stretching them, so without a width
	   the list shrinks to the 15rem every line-item card carries and the technician's note wraps into a
	   column eight lines tall beside an empty modal. */
	width: 100%;
}

/* An exception reads across the record's full width, unlike the pass cards it shares a base class with: it
   carries the note and the raise-request action, and "exceptions first and in full" is the reason the
   record separates them from the passes at all. */
.maintenance-line-item-card.exception-card {
	border: 1px solid var(--gold, #d0a215);
	width: 100%;
}

line-item-note {
	display: block;
	font-size: var(--font-size-small);
	color: var(--light-text);
	padding-top: 0.2rem;
}

/* Roots of EquipmentList and Requests. Unknown elements default to display: inline, which leaves a block
   list laid out inside an inline box. */
equipment-browser,
work-requests-list {
	display: block;
	width: 100%;
}

/* --- Dashboard additions ----------------------------------------------- */

/* The state a well-run facility sees every day, so it is composed rather than left to the inline default.
   Same shape as notes-empty-state and empty-panel-state, in green because "nothing needs attention" is
   a result, not an absence of data. */
no-attention-needed {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	padding: 2.5rem 1rem;
	text-align: center;
	color: var(--success-green);
}

no-attention-needed svg {
	width: 1.75rem;
	height: 1.75rem;
}

no-attention-text {
	display: block;
	max-width: 22rem;
	font-size: var(--font-size-normal);
	color: var(--light-text);
}

.muted-metric {
	color: var(--light-text);
}

attention-overflow {
	display: block;
	padding: 0.5rem 0.25rem;
	font-size: var(--font-size-small);
	color: var(--light-text);
}

attention-triangle.attention-critical svg {
	color: var(--red, #d9534f);
}

/* The volume row carries four cards rather than three, so it needs its own column count - the shared
   .secondary-metrics rule is a three-up grid. */
maintenance-dashboard dashboard-row.quad-metrics {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1400px) {
	maintenance-dashboard dashboard-row.quad-metrics {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* The row also carries .secondary-metrics, whose single-column rule lives earlier in the file at equal
   specificity - so without this the volume cards stayed two across on a phone while every other row
   collapsed. Restated here rather than reordered, since the quad rules have to stay after the shared ones. */
@media (max-width: 768px) {
	maintenance-dashboard dashboard-row.quad-metrics {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Eight sections will not wrap into anything readable at phone width, so the rail scrolls sideways as
	   one track instead of stacking into four rows of pills that push the page's content off the screen. */
	maintenance-management maintenance-nav {
		align-self: stretch;
		margin: 0;
		overflow-x: auto;
		flex-wrap: nowrap;
	}

	maintenance-management maintenance-nav button { white-space: nowrap; }

	maintenance-chrome .page-header {
		flex-wrap: wrap;
		row-gap: 0.5rem;
	}

	maintenance-chrome .page-header row-layout {
		flex-wrap: wrap;
		gap: 0.5rem;
	}
}
/* The calendar tab. Read-only by design: it is where the three dated things the module records - walks
   logged, round occurrences owed or coming, and faults still open - line up against each other. Everything
   it draws opens the modal that already exists for it elsewhere in the module. */

/* The colour key itself is not styled here: <calendar-legend> / <legend-key> are already a shared
   component (unscoped element rules in absencemanagement.css, built from the same status-pill tokens the
   events take), and a second copy of them is exactly how two keys to one palette drift apart. Only its
   placement in this header row is maintenance's business - the shared rule leaves a bottom margin for a
   legend that sits above its calendar, which here would push it off the row's centre line. */
maintenance-management calendar-management calendar-legend {
	margin-bottom: 0;
}

/* Takes the rest of the panel below the header row, so switching tabs does not move the heading. */
calendar-container {
	display: block;
	width: 100%;
	flex: 1;
	min-height: 0;
}

maintenance-calendar {
	display: block;
	width: 100%;
}

/* FullCalendar sizes itself against a definite ancestor height, and it has none here - a percentage height
   resolves to nothing and the grid collapses. The explicit height (with !important, to beat the inline style
   FullCalendar writes) is what the leave calendars need for the same reason. The offset accounts for the page
   header, the section nav, and this section's own header row. */
#maintenanceCalendar {
	height: calc(100vh - 24rem) !important;
	/* The floor is what decides whether a busy day shows anything at all. A month is six rows under a 3.5rem
	   header; each event block is two lines (31px at the 13px root) under a 24px day number, and FullCalendar
	   only draws an event when the "+N more" link fits beneath it. At 30rem a 900px viewport gave 81px rows,
	   so every Monday - a daily walk plus a weekly one - read as "+2 more" over an empty cell. 52rem makes a
	   row ~105px: two events and the link, at the cost of the page scrolling on a laptop. */
	min-height: 52rem;
}

/* calendar.css strips the border off every event (.fc-h-event { border: none }), which would leave the
   borderColor the server sets inert. It is put back here because it is the only thing separating two
   events of the same state stacked in one day cell from reading as a single block - the colour comes from
   FullCalendar's inline border-color, which is why no colour is named. */
.fc .maintenance-event {
	border: 1px solid;
	border-radius: 0.35rem;
	padding: 0.1rem 0.3rem;
	overflow: hidden;
	cursor: pointer;
}

.fc .maintenance-event .maintenance-event-body {
	display: flex;
	flex-direction: column;
	line-height: 1.25;
	overflow: hidden;
}

.fc .maintenance-event .maintenance-event-title {
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* The second line is context, so it steps back from the title rather than competing with it. Softened by
   opacity rather than given a colour of its own, which keeps it legible on all four pill backgrounds
   without a second palette to keep in step with the first. */
.fc .maintenance-event .maintenance-event-meta {
	display: flex;
	align-items: baseline;
	gap: 0.3rem;
	overflow: hidden;
	opacity: 0.8;
	font-size: var(--font-size-small);
}

/* LOGGED / DUE / PLANNED / FAULT. Small and set in capitals so it reads as a label rather than as part of
   the sentence next to it - see MaintenanceCalendarEventPropsModel.KindLabel for why it is on the event at
   all rather than left to the legend. */
.fc .maintenance-event .maintenance-event-kind {
	flex: 0 0 auto;
	font-size: 0.62rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.fc .maintenance-event .maintenance-event-detail {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* A projected occurrence is arithmetic, not a commitment: it assumes every walk before it happens on its
   due date, and logging one re-anchors the whole sequence. Dashed and faded so it never reads as firmly as
   the occurrence that is actually owed. */
.fc .maintenance-event-projected {
	border-style: dashed;
	opacity: 0.72;
}

/* In list view FullCalendar renders its own row chrome and puts eventContent in the title cell, where a
   stacked two-line body just adds height - the row already has a date column doing that job. */
.fc .fc-list-event .maintenance-event-body {
	flex-direction: row;
	align-items: baseline;
	gap: 0.5rem;
}
