/* Fonts are served from this deployment rather than fetched from a third party.
   The client owns this system and runs it on their own server: an external call
   on every page load is a dependency they did not ask for, it leaks who is
   using the system, and it is the first thing to fail on a phone with one bar
   in a truck. 64 KB, cached, and it works offline. */

@font-face {
	font-family: 'IBM Plex Sans';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/assets/fonts/plex-sans-400.woff2') format('woff2');
}
@font-face {
	font-family: 'IBM Plex Sans';
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url('/assets/fonts/plex-sans-500.woff2') format('woff2');
}
@font-face {
	font-family: 'IBM Plex Sans';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url('/assets/fonts/plex-sans-600.woff2') format('woff2');
}
@font-face {
	font-family: 'IBM Plex Sans Condensed';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url('/assets/fonts/plex-condensed-600.woff2') format('woff2');
}
@font-face {
	font-family: 'IBM Plex Sans Condensed';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('/assets/fonts/plex-condensed-700.woff2') format('woff2');
}
@font-face {
	font-family: 'IBM Plex Mono';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/assets/fonts/plex-mono-400.woff2') format('woff2');
}

/* =============================================================================
   Service Business OS — base stylesheet
   Linked first on every screen. Page-specific rules go in a <style> block
   below this link, never inline on elements.
   ========================================================================== */

:root {
	/* Dominant: deep petrol, the color of the chassis.
	   Accent: amber, used sparingly and only where the eye must go. */
	--petrol-900: #0e1f27;
	--petrol-800: #14303c;
	--petrol-700: #1b4152;
	--petrol-600: #235468;
	--petrol-400: #4d8299;
	--petrol-200: #a8c4d0;

	--amber-600:  #b4610a;
	--amber-500:  #d97706;
	--amber-400:  #f59e0b;
	--amber-100:  #fef3c7;

	--ink:        #16232a;
	--ink-soft:   #4a5f6a;
	--ink-faint:  #7c909b;

	--surface:        #ffffff;
	--surface-sunk:   #f4f7f8;
	--surface-raised: #ffffff;
	--stripe:         #f8fafb;

	--line:        #c3d2d9;
	--line-strong: #93a9b4;

	--ok:      #16794a;
	--ok-bg:   #dcfce7;
	--warn:    #a16207;
	--warn-bg: #fef9c3;
	--bad:     #b02a2a;
	--bad-bg:  #fee2e2;
	--info:    var(--petrol-700);
	--info-bg: #e0f0f6;

	--font-body: 'IBM Plex Sans', 'Segoe UI', 'Helvetica Neue', sans-serif;
	--font-head: 'IBM Plex Sans Condensed', 'IBM Plex Sans', 'Segoe UI', sans-serif;
	--font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Code', monospace;

	--radius:    4px;
	--radius-lg: 6px;
	--pad:       14px;
	--gap:       6px;
	--control-h: 40px;
	--row-h:     32px;

	--shadow:    0 1px 2px rgba(14, 31, 39, .10);
	--shadow-lg: 0 4px 14px rgba(14, 31, 39, .14);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--ink:        #e6eef2;
		--ink-soft:   #a9bcc6;
		--ink-faint:  #7b909c;

		--surface:        #101f26;
		--surface-sunk:   #0b171d;
		--surface-raised: #162a33;
		--stripe:         #13252d;

		--line:        #2a4652;
		--line-strong: #3d6373;

		--ok-bg:   #08301f;
		--warn-bg: #33270a;
		--bad-bg:  #3a1414;
		--info-bg: #0e2c38;
	}
}

:root[data-theme="dark"] {
	--ink:        #e6eef2;
	--ink-soft:   #a9bcc6;
	--ink-faint:  #7b909c;

	--surface:        #101f26;
	--surface-sunk:   #0b171d;
	--surface-raised: #162a33;
	--stripe:         #13252d;

	--line:        #2a4652;
	--line-strong: #3d6373;

	--ok-bg:   #08301f;
	--warn-bg: #33270a;
	--bad-bg:  #3a1414;
	--info-bg: #0e2c38;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	font-family: var(--font-body);
	font-size: 14px;
	line-height: 1.4;
	color: var(--ink);
	background: var(--surface-sunk);
	-webkit-font-smoothing: antialiased;
}

/* ---- Typography ---------------------------------------------------------- */

h1, h2, h3, h4 {
	font-family: var(--font-head);
	font-weight: 600;
	letter-spacing: .01em;
	margin: 0 0 8px;
	color: var(--ink);
}

h1 { font-size: 1.4rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; font-weight: 700; }
h4 { font-size: .9rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }

p  { margin: 0 0 10px; max-width: 700px; }

a { color: var(--petrol-700); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono, .num { font-family: var(--font-mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }

.muted  { color: var(--ink-soft); }
.faint  { color: var(--ink-faint); }
.right  { text-align: right; }
.nowrap { white-space: nowrap; }

/* Money reads down a column when the decimal points line up. */
.right-align { text-align: right; }

/* Moving between days, and the heading of one visit. */
.day-bar    { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.day-title  { font-size: 1.05rem; }
.visit-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.visit-time { font-weight: 600; font-variant-numeric: tabular-nums; }

/* The number the whole estimate comes to, where the eye lands first. */
.total-headline { font-size: 1.3rem; font-weight: 600; }

/* The option the customer is taking, marked without shouting. */
.option-chosen { border-left: 3px solid var(--amber-500); }

.quantity-input { width: 64px; height: 28px; padding: 2px 6px; font-size: 13px; }

/* What a job can do next: one move per line, so a reason box never wanders
   away from the button it belongs to. */
.job-moves { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.job-move  { display: flex; align-items: center; gap: 8px; margin: 0; }
.job-move .btn-sm { min-width: 128px; }
.reason-input { width: 260px; height: 28px; padding: 2px 8px; font-size: 13px; }
.data td.right-align, .data th.right-align { text-align: right; }

/* Moving between days, and the heading of one visit. */
.day-bar    { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.day-title  { font-size: 1.05rem; }
.visit-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.visit-time { font-weight: 600; font-variant-numeric: tabular-nums; }

/* The number the whole estimate comes to, where the eye lands first. */
.total-headline { font-size: 1.3rem; font-weight: 600; }

/* The option the customer is taking, marked without shouting. */
.option-chosen { border-left: 3px solid var(--amber-500); }

.quantity-input { width: 64px; height: 28px; padding: 2px 6px; font-size: 13px; }

/* What a job can do next: one move per line, so a reason box never wanders
   away from the button it belongs to. */
.job-moves { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.job-move  { display: flex; align-items: center; gap: 8px; margin: 0; }
.job-move .btn-sm { min-width: 128px; }
.reason-input { width: 260px; height: 28px; padding: 2px 8px; font-size: 13px; }
@media (max-width: 720px) {
	.data.reflow td.right-align { text-align: left; }

	/* Narrow enough that the account name is the thing to give up: it is on the
	   account page and in the menu, and Sign out being reachable matters more. */
	.topbar > a.muted { display: none; }
}

/* ---- App shell ----------------------------------------------------------- */

/* Only ever seen on a narrow screen, where the sidebar is folded away. Named
   with its parent so it beats .btn, which is declared later and would
   otherwise put it back on every screen. */
.topbar .menu-toggle { display: none; }

.app {
	display: grid;
	/* minmax(0, 1fr), not 1fr. A grid column is at least as wide as its widest
	   child unless it is told otherwise, so one wide table pushed the whole
	   page sideways — every screen scrolled 13 to 35 pixels and "Sign out" sat
	   off the right edge of a phone. Told it may shrink, the column holds the
	   viewport and the wide thing scrolls inside its own box instead. */
	grid-template-columns: 216px minmax(0, 1fr);
	grid-template-rows: auto 1fr;
	grid-template-areas: "brand topbar" "sidebar main";
	min-height: 100vh;
}

.brand {
	grid-area: brand;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 var(--pad);
	height: 48px;
	background: var(--petrol-900);
	color: #fff;
	font-family: var(--font-head);
	font-weight: 700;
	letter-spacing: .04em;
	border-bottom: 1px solid var(--petrol-800);
}
.brand .mark {
	width: 20px; height: 20px;
	border-radius: 3px;
	background: var(--amber-500);
	flex: none;
}
.brand .mark-image { width: 30px; height: 30px; object-fit: contain; flex: none; }

.topbar {
	grid-area: topbar;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 var(--pad);
	height: 48px;
	background: var(--surface);
	border-bottom: 1px solid var(--line);
}
.topbar .spacer { flex: 1; }

/* On a phone the bar held a menu button, the page name, a help mark, the
   account name and Sign out — more than the width, and told never to wrap, so
   Sign out sat off the right edge of every screen in the system. The page name
   and the account name give way; the buttons do not. */
.topbar > strong,
.topbar > a.muted {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.topbar > a.muted { flex: 0 1 auto; }

.sidebar {
	grid-area: sidebar;
	background: var(--petrol-900);
	padding: 10px 0;
	overflow-y: auto;
}
.sidebar a {
	display: block;
	padding: 9px var(--pad);
	color: #eef3f8;
	font-size: 1.05rem;
	line-height: 1.3;
	border-left: 3px solid transparent;
}
/* Inside a group, the entries are the quieter half. The group heading is the
   thing being scanned for — somebody looks for "Money" and then for the screen
   inside it — so the heading is bright and its entries sit under it. This was
   the other way round, which made every group heading look switched off and
   every entry shout. */
.sidebar .nav-group a { color: var(--petrol-200); }

.sidebar a:hover { background: var(--petrol-800); color: #fff; text-decoration: none; }
.sidebar a.active {
	background: var(--petrol-800);
	color: #fff;
	border-left-color: var(--amber-500);
	font-weight: 600;
}
.sidebar .group {
	padding: 14px var(--pad) 6px;
	font-family: var(--font-head);
	font-size: .84rem;
	text-transform: uppercase;
	letter-spacing: .09em;
	color: #eef3f8;
}
.sidebar summary.group {
	cursor: pointer;
	list-style: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-right: var(--pad);
	user-select: none;
}
.sidebar summary.group::-webkit-details-marker { display: none; }
.sidebar summary.group::after {
	content: '';
	width: 7px; height: 7px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform .15s;
}
.sidebar details[open] summary.group::after { transform: rotate(45deg); }
.sidebar summary.group:hover { color: #fff; }
.sidebar .nav-group a { padding-left: calc(var(--pad) + 12px); }

main {
	grid-area: main;
	padding: var(--pad);
	overflow-x: auto;
}

.page-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 10px;
	margin-bottom: 12px;
}
/* A long organization name must not squeeze itself into a narrow column and
   push the badges into the middle of the page. It takes the width it needs and
   anything after it wraps below. */
.page-head h1 { flex: 1 1 100%; margin-bottom: 2px; }
.page-head h1 + * { margin-left: 0; }
.page-head .spacer { flex: 1; }

/* ---- Layout: multi-column by default ------------------------------------- */

/* A grid child is allowed to be narrower than its widest content, so a wide
   table inside a card scrolls in its own box instead of pushing the column —
   and the last column off the side of the page. */
.grid > *, .grid-wide > *, .grid-stats > *, .split > * { min-width: 0; }

.grid       { display: grid; gap: var(--pad); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-stats { display: grid; gap: var(--pad); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-wide  { display: grid; gap: var(--pad); grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }

/* List on the left, detail on the right. */
.split { display: grid; gap: var(--pad); grid-template-columns: 25% 1fr; }

@media (max-width: 900px) {
	/* Three rows now, not two: with the desktop's "auto 1fr" the topbar took
	   every spare pixel and the page began a screen and a half down. */
	.app {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto auto 1fr;
		grid-template-areas: "brand" "topbar" "main";
	}
	.sidebar { display: none; }
	/* The folded-away navigation takes the page over when it is opened, rather
	   than being drawn on top of it — they share the same grid cell. */
	.sidebar.open { display: block; grid-area: main; }
	.sidebar.open ~ main { display: none; }
	.topbar .menu-toggle { display: inline-flex; }
	.split { grid-template-columns: 1fr; }
}

/* ---- Cards --------------------------------------------------------------- */

.card {
	background: var(--surface-raised);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	padding: var(--pad);
	box-shadow: var(--shadow);
}
.card > h3, .card > h4 { margin-top: 0; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .label {
	font-family: var(--font-head);
	font-size: .74rem;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--ink-soft);
}
.stat .value {
	font-family: var(--font-head);
	font-size: 1.6rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}

/* ---- Forms --------------------------------------------------------------- */

.form { display: grid; gap: var(--pad); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.form .full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: var(--gap); }
.field > label {
	font-size: .82rem;
	font-weight: 500;
	color: var(--ink-soft);
}
/* Explanatory text, wherever it appears.
 *
 * Only ever styled inside a form field, so the sentence under a heading that
 * explains what a screen is for — marked as a hint on nearly every screen in
 * the product — read at full weight and competed with the thing it explains. */
.hint { color: var(--ink-faint); font-size: .85rem; }
.hint.block { display: block; }
.field .hint { font-size: .78rem; color: var(--ink-faint); }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="date"], input[type="time"], input[type="search"],
select, textarea {
	width: 100%;
	height: var(--control-h);
	padding: 0 9px;
	font-family: inherit;
	font-size: 14px;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
}
textarea { height: auto; min-height: 72px; padding: 7px 9px; resize: vertical; }
select { padding-right: 4px; }

input:focus, select:focus, textarea:focus {
	outline: 2px solid var(--amber-400);
	outline-offset: -1px;
	border-color: var(--amber-500);
}
input:disabled, select:disabled, textarea:disabled {
	background: var(--surface-sunk);
	color: var(--ink-faint);
}
input.error, select.error, textarea.error { border-color: var(--bad); }

.field-error { font-size: .78rem; color: var(--bad); }

/* Password fields get a show/hide toggle. */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }
.password-wrap button {
	position: absolute;
	top: 0; right: 0;
	height: var(--control-h);
	padding: 0 9px;
	border: 0;
	background: none;
	color: var(--petrol-700);
	font-size: .78rem;
	font-weight: 500;
	cursor: pointer;
}

/* ---- Buttons ------------------------------------------------------------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: var(--control-h);
	padding: 0 20px;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	cursor: pointer;
	white-space: nowrap;
}
.btn:hover { background: var(--surface-sunk); }
.btn:focus-visible { outline: 2px solid var(--amber-400); outline-offset: 1px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
	background: var(--petrol-700);
	border-color: var(--petrol-700);
	color: #fff;
}
.btn-primary:hover { background: var(--petrol-800); }

.btn-accent {
	background: var(--amber-500);
	border-color: var(--amber-600);
	color: #2a1503;
}
.btn-accent:hover { background: var(--amber-400); }

.btn-danger { color: var(--bad); border-color: var(--bad); background: var(--surface); }
.btn-danger:hover { background: var(--bad-bg); }

.btn-sm { height: 30px; padding: 0 12px; font-size: 13.5px; }

/* ---- Tabs ---------------------------------------------------------------- */
/* Used by the work screens, the settings screens and the phone screens, so it
   lives here rather than in any one of their stylesheets. It was in
   automation.css, which meant a screen that did not happen to load that file
   drew its tabs as a row of bare blue links. */

.auto-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 18px;
	padding-bottom: 4px;
	border-bottom: 2px solid var(--line);
}

.auto-tabs a {
	flex: 0 0 auto;
	padding: 11px 20px;
	border: 1px solid var(--line);
	border-radius: var(--radius) var(--radius) 0 0;
	background: var(--surface-raised);
	color: var(--ink-soft);
	font-size: 1rem;
	font-weight: 500;
	white-space: nowrap;
	text-decoration: none;
}

.auto-tabs a:hover { background: var(--info-bg); text-decoration: none; }

.auto-tabs a.active {
	border-color: var(--petrol-700);
	background: var(--petrol-700);
	color: #fff;
	font-weight: 600;
}

.field-tabs {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	margin-bottom: 16px;
	padding-bottom: 4px;
	-webkit-overflow-scrolling: touch;
}
.field-tabs a {
	flex: 0 0 auto;
	padding: 11px 18px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--surface-raised);
	color: var(--ink-soft);
	font-size: .97rem;
	font-weight: 500;
	white-space: nowrap;
	text-decoration: none;
}
.field-tabs a:hover { background: var(--info-bg); text-decoration: none; }
.field-tabs a.active {
	border-color: var(--petrol-700);
	background: var(--petrol-700);
	color: #fff;
	font-weight: 600;
}

/* ---- Tables -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-raised); }

table.data {
	width: 100%;
	border-collapse: collapse;
	font-size: 13.5px;
}
table.data th {
	height: var(--row-h);
	padding: 0 12px;
	text-align: left;
	font-family: var(--font-head);
	font-size: .76rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .07em;
	color: var(--ink-soft);
	background: var(--surface-sunk);
	border-bottom: 1px solid var(--line-strong);
	white-space: nowrap;
}
table.data td {
	height: var(--row-h);
	padding: 0 12px;
	border-bottom: 1px solid var(--line);
}
table.data tbody tr:nth-child(even) { background: var(--stripe); }
table.data tbody tr:hover { background: var(--info-bg); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty {
	padding: 28px var(--pad);
	text-align: center;
	color: var(--ink-soft);
}

/* ---- Badges and status --------------------------------------------------- */

.badge {
	display: inline-flex;
	align-items: center;
	height: 20px;
	padding: 0 7px;
	border-radius: 3px;
	font-family: var(--font-head);
	font-size: .72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .05em;
	white-space: nowrap;
}
.badge-ok   { background: var(--ok-bg);   color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad  { background: var(--bad-bg);  color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* ---- Notices ------------------------------------------------------------- */

.notice {
	padding: 9px 12px;
	border: 1px solid var(--line-strong);
	border-left-width: 3px;
	border-radius: var(--radius);
	margin-bottom: 12px;
	font-size: 13.5px;
}
.notice-ok   { background: var(--ok-bg);   border-left-color: var(--ok);   color: var(--ok); }
.notice-warn { background: var(--warn-bg); border-left-color: var(--warn); color: var(--warn); }
.notice-bad  { background: var(--bad-bg);  border-left-color: var(--bad);  color: var(--bad); }
.notice-info { background: var(--info-bg); border-left-color: var(--info); color: var(--info); }

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

/* ---- Centred single-panel screens (login, errors) ------------------------ */

.centre-screen {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: var(--pad);
	background:
		radial-gradient(1100px 460px at 50% -10%, var(--info-bg), transparent 70%),
		var(--surface-sunk);
}
.panel {
	width: 100%;
	max-width: 380px;
	background: var(--surface-raised);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	padding: 24px;
	box-shadow: var(--shadow-lg);
}
.panel-head { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.panel-head .mark {
	width: 26px; height: 26px;
	border-radius: 4px;
	background: var(--amber-500);
	flex: none;
}
.panel-head .title {
	font-family: var(--font-head);
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: .03em;
}
.panel-head.has-logo { justify-content: center; margin-bottom: 14px; }
.panel-head .logo { display: block; max-width: 280px; width: 100%; height: auto; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---- Typeahead ----------------------------------------------------------- */

.typeahead-wrap { position: relative; }

.typeahead-results {
	position: absolute;
	top: calc(var(--control-h) + 2px);
	left: 0;
	right: 0;
	z-index: 40;
	max-height: 320px;
	overflow-y: auto;
	background: var(--surface-raised);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	box-shadow: var(--shadow-lg);
}
.typeahead-results a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 7px 11px;
	color: var(--ink);
	border-bottom: 1px solid var(--line);
}
.typeahead-results a:last-child { border-bottom: 0; }
.typeahead-results a:hover,
.typeahead-results a.active { background: var(--info-bg); text-decoration: none; }
.typeahead-empty { padding: 12px; color: var(--ink-soft); font-size: 13.5px; }

/* ---- Breadcrumbs --------------------------------------------------------- */

.crumbs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	font-size: .84rem;
	margin-bottom: 8px;
	color: var(--ink-soft);
}
.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--petrol-700); }
.crumbs .sep { color: var(--ink-faint); }

/* ---- Definition rows ----------------------------------------------------- */

.detail-rows { display: grid; gap: 2px; }
.detail-row {
	display: grid;
	grid-template-columns: 150px 1fr;
	gap: 10px;
	padding: 5px 0;
	border-bottom: 1px solid var(--line);
	font-size: 13.5px;
}
.detail-row:last-child { border-bottom: 0; }
.detail-row .k { color: var(--ink-soft); }

@media (max-width: 640px) {
	.detail-row { grid-template-columns: 1fr; gap: 2px; }
	/* Lists become cards rather than a table scrolled sideways on a phone. */
	table.data.reflow thead { display: none; }
	table.data.reflow, table.data.reflow tbody, table.data.reflow tr, table.data.reflow td { display: block; width: 100%; }
	table.data.reflow tr {
		border: 1px solid var(--line);
		border-radius: var(--radius);
		margin-bottom: 8px;
		padding: 6px 0;
	}
	table.data.reflow td { height: auto; border: 0; padding: 4px 12px; }
	table.data.reflow td::before {
		content: attr(data-label) ": ";
		color: var(--ink-soft);
		font-size: .78rem;
	}
	table.data.reflow td:first-child::before { content: ""; }
	table.data.reflow td:first-child { font-weight: 600; font-size: 15px; }
}


/* A long history, indexed by year.
   Five years of weekly service is 260 visits. The years are the index and each
   one is about fifty rows — a table somebody can read — so these sit above the
   table and wrap rather than scroll on a phone. */

.year-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 10px;
}

.year-tabs .btn { font-variant-numeric: tabular-nums; }
.year-tabs .btn .muted { margin-left: 4px; font-size: .85em; }
.year-tabs .btn-primary .muted { color: inherit; opacity: .8; }


/* ---- Utilities -----------------------------------------------------------
   These exist so markup carries no inline style attributes. The content
   security policy blocks those outright, and the coding standard forbids them
   regardless: a style written into a page is one nobody can find later.
   -------------------------------------------------------------------------- */

.mt-0  { margin-top: 0; }
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mb-0  { margin-bottom: 0; }
.mb-3  { margin-bottom: 12px; }
.mb-4  { margin-bottom: 14px; }
.m-0   { margin: 0; }

.row        { display: flex; align-items: center; gap: 8px; }
.row-wrap   { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.grow       { flex: 1; }
.right-end  { display: flex; justify-content: flex-end; }
.actions    { display: flex; gap: 8px; margin-top: 16px; }

.checks       { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.check        { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.check input  { width: auto; height: auto; }

.small     { font-size: .82rem; }
.smaller   { font-size: .78rem; }
.tight     { font-size: 13px; }
.value-sm  { font-size: 1.1rem; }
.uuid      { font-size: .8rem; }

.entry     { padding: 10px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.group-row { background: var(--surface-sunk); }
.inline-form { margin: 0; display: inline-block; }
.note-inline { margin: 8px 0 0; padding: 6px 9px; font-size: .82rem; }
.clickable { cursor: pointer; }

/* A label only a screen reader needs — the control beside it is obvious to
   anyone who can see it, and the label would only be noise on the page. */
.sr-only {
	position: absolute;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}
.float-right { float: right; }

.full-width    { width: 100%; }
.weight-normal { font-weight: 400; }
.col-wide      { min-width: 260px; }
.auto-size     { width: auto; height: auto; }

/* Buttons in a table's action column stay on one line rather than stacking. */
/* Buttons in the last column of a table sit in a row, not a stack.
 *
 * An action cell holds a link and a one-button form, and a form is a block: it
 * took the whole width and pushed the button under the link, out of its own
 * row. Laid out as a row here rather than left to each screen to remember. */
/* ---- One customer, on one page -------------------------------------------
   A wide column of the work — who they are, where the pool is, what to do
   there, what was done — and a narrow one of the facts you glance at: what
   they buy, how they want to hear, their own page. Cards sit to their own
   height rather than stretching to the tallest beside them, which is what put
   a thousand pixels of nothing down the middle of this page. */

.contact-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
	align-items: start;
	gap: 16px;
	margin-top: 16px;
}
.contact-main,
.contact-side {
	display: grid;
	/* minmax(0, 1fr), not the default auto — the same fault as the app shell
	   above, one level further in. A grid column is at least as wide as its
	   widest child's minimum unless it is told otherwise, so one card that
	   would not shrink set the column width and every other card stretched to
	   match it. On a 390px phone all four cards on a customer's record came
	   out 430px wide and the right-hand 40px were cut off with no way to
	   scroll to them, because the column outside this one scrolls instead. */
	grid-template-columns: minmax(0, 1fr);
	align-content: start;
	gap: 16px;
	min-width: 0;
}

/* And the cards themselves may shrink. A grid item's min-width is auto, which
   means "never smaller than my content" — the setting that made one long
   email address decide the width of the page. Anything genuinely too wide to
   fit now scrolls inside its own box, which is what .table-wrap is for. */
.contact-main > *,
.contact-side > * { min-width: 0; }

/* The facts column is read, not worked in, so it is quieter than the work. */
.contact-side .card { padding: 12px 14px; }
.contact-side h3 { font-size: .95rem; }
.contact-side .detail-row { font-size: .85rem; }

/* Below a laptop there is one column, and the work comes first. */
@media (max-width: 1100px) {
	.contact-layout { grid-template-columns: minmax(0, 1fr); }
}

/* A card that stays folded until somebody wants what is inside it — the rule
   builder, and anything else most people never open. The heading looks like a
   heading, because that is what it is until it is pressed. */
.build-your-own {
	font-family: var(--font-head);
	font-size: 1.2rem;
	font-weight: 700;
	cursor: pointer;
	list-style: none;
}
.build-your-own::-webkit-details-marker { display: none; }
.build-your-own::before {
	content: '+';
	display: inline-block;
	width: 1.1em;
	color: var(--ink-soft);
	font-weight: 700;
}
details[open] > .build-your-own::before { content: '\2212'; }

/* Buttons at the end of a row, side by side.
 *
 * Laid out with inline children rather than by making the cell itself a flex
 * container. A td told to be flex stops being a table cell: it no longer
 * stretches to the height of its row, so the moment the buttons are too wide
 * to sit on one line they wrap out of the bottom of the cell and print over
 * the row underneath. It looked fine everywhere it was first used, because
 * nowhere it was first used had two buttons and a narrow column. */
.data td.actions-cell {
	white-space: nowrap;
	text-align: right;
	vertical-align: middle;
}
.data td.actions-cell > * { vertical-align: middle; }
.data td.actions-cell > * + * { margin-left: 6px; }


/* One way of reaching somebody, while it is being edited: what kind, the value
   taking the room, and Remove at the end. */
.method-edit {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}
.method-edit select { flex: 0 0 110px; }
.method-edit input[type="text"] { flex: 1 1 auto; min-width: 0; }
.method-edit .check { flex: 0 0 auto; white-space: nowrap; }

/* What was actually said, folded until somebody wants the rest of it. */
.said-more > summary {
	font-size: .85rem;
	cursor: pointer;
	list-style: none;
}
.said-more > summary::-webkit-details-marker { display: none; }
.said-more > summary::after {
	content: ' more';
	color: var(--petrol-700);
	font-weight: 600;
}
.said-more[open] > summary { display: none; }
.said-whole {
	margin: 0;
	font-size: .85rem;
	white-space: normal;
	overflow-wrap: anywhere;
}

/* A message that did not arrive, and the button that sends it again. */
.failed-line {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	padding: 5px 0;
	font-size: .85rem;
}
.failed-line + .failed-line { border-top: 1px solid var(--line); }
.failed-line .spacer { flex: 1; }

/* A list of things sent, where a table would have been five columns wide in a
   column that is not. */
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li {
	padding: 7px 0;
	border-top: 1px solid var(--line);
}
.link-line {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
}
.link-line .spacer { flex: 1; }
.link-to { overflow-wrap: anywhere; }

/* One way of reaching somebody: what kind it is, the value, then what can be
   done to it pushed to the end of the line so a column of them lines up
   instead of reading as a pile of buttons. */
.method-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	padding: 5px 0;
	border-top: 1px solid var(--line);
}
.method-row .spacer { flex: 1; }
.method-row .btn-sm { padding: 1px 7px; }

.method-kind {
	flex: 0 0 52px;
	color: var(--ink-faint);
	font-size: .78rem;
	text-transform: uppercase;
	letter-spacing: .05em;
}

/* The question asked before something is destroyed. */
.confirm {
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 16px 20px;
	max-width: 420px;
	color: var(--ink);
	background: var(--surface);
}
.confirm h3 { margin: 0 0 6px; }
.confirm p { margin: 0 0 14px; }
.confirm::backdrop { background: rgb(0 0 0 / 45%); }

/* A form opened over the page: adding a customer, editing one. Wide enough for
   two columns of fields, and it scrolls rather than running off the screen on a
   phone held in a truck. */
.sheet {
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 0;
	width: min(760px, 94vw);
	max-height: 88vh;
	color: var(--ink);
	background: var(--surface);
}
.sheet::backdrop { background: rgb(0 0 0 / 45%); }
.sheet > .card {
	margin: 0;
	border: 0;
	max-height: 88vh;
	overflow-y: auto;
}
.sheet-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}
.sheet-head h3 { margin: 0; }

/* ---- Files and photographs ----------------------------------------------- */

.file-grid {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.file-card {
	padding: 10px;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	background: var(--surface-raised);
}
.file-thumb {
	display: block;
	width: 100%;
	height: 140px;
	object-fit: cover;
	border-radius: var(--radius);
	background: var(--surface-sunk);
	margin-bottom: 8px;
}
.file-name { font-weight: 600; overflow-wrap: anywhere; }

/* ---- Signing on a screen -------------------------------------------------- */

.signature-pad canvas {
	width: 100%;
	max-width: 600px;
	height: 180px;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	background: var(--surface);
	touch-action: none;
	cursor: crosshair;
}
.signature-thumb { height: 90px; object-fit: contain; background: var(--surface); }


/* ---- Reviews ------------------------------------------------------------- */

.review-stars { color: var(--amber-500); letter-spacing: 2px; }

.review-comment { margin: 6px 0 0; max-width: 70ch; }

/* What was said back, set apart from what they said, because reading the two
   as one paragraph is how a reply gets mistaken for the review. */
.review-reply {
	margin-top: 12px;
	padding: 10px 14px;
	border-left: 3px solid var(--petrol-700);
	border-radius: 0 var(--radius) var(--radius) 0;
	background: var(--surface-sunk);
	max-width: 70ch;
}
.review-reply strong { display: block; margin-bottom: 4px; font-size: .9rem; color: var(--ink-soft); }


/* Hidden means hidden.
 *
 * A browser hides [hidden] with display:none at the very bottom of its own
 * stylesheet, which any rule of ours beats — and .btn sets display:inline-flex.
 * So a button the page had genuinely marked hidden went on being drawn, and the
 * take-on form showed Back, Next and "Take them on" all at once on its first
 * step. Everything since that uses hidden — the wizard, the equipment fields,
 * the dialogs — depended on this and did not have it. */
[hidden] { display: none !important; }

/* ---- A button somebody reaches for without looking ----------------------- */
/* The one action on a screen that matters more than the rest of it. Used for
   taking on a customer, which on a route is the thing that grows the business
   and is done standing up, often on a phone. */

.btn-large {
	height: auto;
	min-height: 52px;
	padding: 12px 28px;
	font-size: 1.15rem;
	font-weight: 700;
	border-radius: 8px;
}

/* ---- One form, a step at a time ------------------------------------------ */

.sheet-wide { width: min(860px, 96vw); }

.wizard-steps {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 16px;
	font-size: .92rem;
	color: var(--ink-soft);
}
.wizard-steps span {
	padding: 6px 12px;
	border: 1px solid var(--line);
	border-radius: 999px;
}
.wizard-steps span.active {
	border-color: var(--petrol-700);
	background: var(--petrol-700);
	color: #fff;
	font-weight: 600;
}
.wizard-steps span.done { border-color: var(--ok); color: var(--ok); }

.wizard-actions { justify-content: space-between; }

/* What the round already says about a new address: which day it comes near,
   and the times that day has nothing in them. */
.round-advice { background: var(--info-bg); border-left-color: var(--info); }
.round-advice p { margin: 0 0 6px; }
.round-advice p:last-child { margin-bottom: 0; }
.round-advice-times {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
}
.round-advice-times .btn.chosen {
	border-color: var(--petrol-700);
	background: var(--petrol-700);
	color: #fff;
}
