/* ==========================================================================
   Diplo Apart — design system
   --------------------------------------------------------------------------
   Built from the brand already in use on diploapart.rw: Jost for interface
   text, Playfair Display for display type, and the warm gold / deep navy
   palette from the marketing site. A property portal that looks like a
   different company than the site the tenant booked through erodes trust at
   exactly the moment you are asking them to send money.

   Structure: tokens → reset → layout → typography → components → utilities.
   One stylesheet, no build step, no framework. It is ~1,400 lines and loads
   in a single request on a Kigali mobile connection.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
	/* Brand */
	--gold: #a6754b;
	--gold-soft: #ebcfa7;
	--gold-tint: #f6ecdd;
	--navy: #0c253c;
	--ink: #26282b;

	/* Surfaces */
	--bg: #f7f5f1;
	--surface: #ffffff;
	--surface-2: #fbfaf8;
	--surface-3: #f3f0ea;
	--line: #e6e1d8;
	--line-strong: #d5cec1;

	/* Text */
	--text: #26282b;
	--text-soft: #5c6066;
	--text-muted: #8b8f96;
	--text-invert: #ffffff;

	/* Semantic */
	--success: #1f7a4d;
	--success-bg: #e7f4ed;
	--warn: #a86a12;
	--warn-bg: #fdf2df;
	--danger: #b3261e;
	--danger-bg: #fbeae9;
	--info: #1c5b8a;
	--info-bg: #e8f1f8;

	/* Type */
	--font-sans:
		"Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
		Arial, sans-serif;
	--font-display: "Playfair Display", Georgia, "Times New Roman", serif;
	--font-mono:
		ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas,
		monospace;

	/* Scale */
	--space-1: 0.25rem;
	--space-2: 0.5rem;
	--space-3: 0.75rem;
	--space-4: 1rem;
	--space-5: 1.5rem;
	--space-6: 2rem;
	--space-7: 3rem;
	--space-8: 4rem;

	--radius-sm: 6px;
	--radius: 10px;
	--radius-lg: 16px;
	--radius-full: 999px;

	--shadow-sm: 0 1px 2px rgba(12, 37, 60, 0.05);
	--shadow: 0 2px 8px rgba(12, 37, 60, 0.07), 0 1px 2px rgba(12, 37, 60, 0.04);
	--shadow-lg:
		0 12px 32px rgba(12, 37, 60, 0.12), 0 2px 8px rgba(12, 37, 60, 0.06);

	--header-h: 62px;
	--sidebar-w: 236px;
	--container: 1240px;

	--transition: 140ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode follows the operating system. Staff work in this tool all day and
   a portal that glows white at 23:00 is a portal people avoid opening. */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #14161a;
		--surface: #1c1f24;
		--surface-2: #22262c;
		--surface-3: #2a2f36;
		--line: #313640;
		--line-strong: #414753;

		--text: #eef0f3;
		--text-soft: #b3b9c2;
		--text-muted: #868d98;

		--gold: #d3a877;
		--gold-soft: #6b5334;
		--gold-tint: #2e2519;
		--navy: #dbe6f0;

		--success: #5cc48d;
		--success-bg: #16301f;
		--warn: #e0ad55;
		--warn-bg: #33260f;
		--danger: #f08078;
		--danger-bg: #351817;
		--info: #74b3e0;
		--info-bg: #14293a;

		--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
		--shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
		--shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
	}
}

:root[data-theme="dark"] {
	--bg: #14161a;
	--surface: #1c1f24;
	--surface-2: #22262c;
	--surface-3: #2a2f36;
	--line: #313640;
	--line-strong: #414753;
	--text: #eef0f3;
	--text-soft: #b3b9c2;
	--text-muted: #868d98;
	--gold: #d3a877;
	--gold-soft: #6b5334;
	--gold-tint: #2e2519;
	--navy: #dbe6f0;
	--success: #5cc48d;
	--success-bg: #16301f;
	--warn: #e0ad55;
	--warn-bg: #33260f;
	--danger: #f08078;
	--danger-bg: #351817;
	--info: #74b3e0;
	--info-bg: #14293a;
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

* {
	margin: 0;
}

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

body {
	font-family: var(--font-sans);
	font-size: 15px;
	line-height: 1.55;
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	min-height: 100vh;
}

.d-none {
	display: none !important;
}

img,
svg,
video {
	display: block;
	max-width: 100%;
}

input,
button,
textarea,
select {
	font: inherit;
	color: inherit;
}

button {
	cursor: pointer;
	background: none;
	border: none;
	padding: 0;
}

a {
	color: var(--gold);
	text-decoration: none;
	transition: color var(--transition);
}

a:hover {
	color: var(--ink);
	text-decoration: underline;
}

:focus-visible {
	outline: 2px solid var(--gold);
	outline-offset: 2px;
	border-radius: 3px;
}

/* Respect a user's motion preference — some vestibular conditions make the
   default transitions genuinely unpleasant. */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: -0.01em;
	color: var(--text);
}

h1 {
	font-size: 1.6rem;
}
h2 {
	font-size: 1.25rem;
}
h3 {
	font-size: 1.05rem;
}
h4 {
	font-size: 0.95rem;
}

.display {
	font-family: var(--font-display);
	font-weight: 500;
	letter-spacing: -0.02em;
}

.eyebrow {
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.lede {
	font-size: 1.02rem;
	color: var(--text-soft);
	line-height: 1.65;
}

.muted {
	color: var(--text-muted);
}
.soft {
	color: var(--text-soft);
}
.small {
	font-size: 0.83rem;
}
.tiny {
	font-size: 0.74rem;
}
.strong {
	font-weight: 600;
}
.mono {
	font-family: var(--font-mono);
	font-size: 0.9em;
	letter-spacing: -0.01em;
}
.nowrap {
	white-space: nowrap;
}
.center {
	text-align: center;
}
.right {
	text-align: right;
}

/* Numbers in a column must align on the decimal, or a table of rent figures
   is unreadable at a glance. */
.num {
	font-variant-numeric: tabular-nums;
	text-align: right;
	white-space: nowrap;
}

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.container {
	width: 100%;
	max-width: var(--container);
	margin-inline: auto;
	padding-inline: var(--space-5);
}

.container-narrow {
	max-width: 780px;
}

.stack > * + * {
	margin-top: var(--space-4);
}
.stack-sm > * + * {
	margin-top: var(--space-2);
}
.stack-lg > * + * {
	margin-top: var(--space-6);
}

.row {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}
.row-between {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	flex-wrap: wrap;
}
.row-top {
	align-items: flex-start;
}
.row-wrap {
	flex-wrap: wrap;
}
.spacer {
	flex: 1;
}

.grid {
	display: grid;
	gap: var(--space-4);
}
.grid-2 {
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.grid-3 {
	grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.grid-4 {
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.grid-cards {
	grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.split {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: var(--space-5);
	align-items: start;
}

@media (max-width: 960px) {
	.split {
		grid-template-columns: 1fr;
	}
}

/* --- App shell ------------------------------------------------------------ */
.app {
	display: grid;
	grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
	min-height: 100vh;
}

/*
 * The mobile scrim MUST be display:none on desktop, not merely invisible.
 *
 * `.app` is a two-column grid and `.scrim` is one of its children. Leaving it
 * unstyled here made it an in-flow grid item that claimed row 1 / column 2 —
 * the content column — which pushed `.main` down into row 2 / column 1, the
 * 236px sidebar track. The symptom was main content rendering narrow and
 * underneath the sidebar on desktop while looking correct on mobile, where the
 * grid collapses to a single column and the scrim is position:fixed.
 *
 * Anything placed inside `.app` that is not the sidebar or the main column
 * must be taken out of grid flow the same way.
 */
.scrim {
	display: none;
}

/* Collapsed — an opt-in on desktop, remembered per browser. The sidebar
   track disappears entirely; see the off-canvas rules below. */
.app.is-collapsed {
	grid-template-columns: 1fr;
}

.sidebar {
	background: var(--navy);
	color: rgba(255, 255, 255, 0.86);
	padding: var(--space-4) var(--space-3);
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
}

:root[data-theme="dark"] .sidebar,
:root:not([data-theme="light"]) .sidebar {
	border-right: 1px solid var(--line);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .sidebar {
		background: #10131a;
		color: rgba(255, 255, 255, 0.82);
	}
}

.sidebar-brand {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	padding: var(--space-2) var(--space-3);
	color: #fff;
	font-family: var(--font-sans);
	font-size: 1.12rem;
	letter-spacing: -0.01em;
}

.sidebar-brand:hover {
	text-decoration: none;
	color: var(--gold-soft);
}

.sidebar-brand .mark {
	width: 30px;
	height: 30px;
	border-radius: 8px;
	background: linear-gradient(135deg, var(--gold-soft), var(--gold));
	display: grid;
	place-items: center;
	font-family: var(--font-sans);
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--navy);
	flex-shrink: 0;
}

.nav-group + .nav-group {
	margin-top: var(--space-5);
}

.nav-label {
	font-size: 0.66rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.42);
	padding: 0 var(--space-3);
	margin-bottom: var(--space-2);
}

.nav-link {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: 0.5rem var(--space-3);
	border-radius: var(--radius-sm);
	color: rgba(255, 255, 255, 0.82);
	font-size: 0.9rem;
	transition:
		background var(--transition),
		color var(--transition);
}

.nav-link:hover {
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	text-decoration: none;
}

.nav-link.is-active {
	background: rgba(235, 207, 167, 0.16);
	color: var(--gold-soft);
	font-weight: 500;
}

.nav-link .icon {
	width: 17px;
	height: 17px;
	flex-shrink: 0;
	opacity: 0.85;
}

.nav-link .count {
	margin-left: auto;
	font-size: 0.72rem;
	font-weight: 600;
	background: var(--gold);
	color: var(--navy);
	border-radius: var(--radius-full);
	padding: 0.05rem 0.4rem;
	min-width: 20px;
	text-align: center;
}

.main {
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.topbar {
	height: var(--header-h);
	background: var(--surface);
	border-bottom: 1px solid var(--line);
	display: flex;
	align-items: center;
	gap: var(--space-4);
	padding-inline: var(--space-5);
	position: sticky;
	top: 0;
	z-index: 20;
}

.page {
	padding: var(--space-6) var(--space-5) var(--space-8);
	flex: 1;
}

.page-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--space-4);
	flex-wrap: wrap;
	margin-bottom: var(--space-5);
}

.page-head h1 {
	font-size: 1.5rem;
}

.page-head .sub {
	color: var(--text-muted);
	font-size: 0.88rem;
	margin-top: 0.15rem;
}

.sidebar-toggle {
	display: none;
	color: var(--text-muted);
	transition:
		background var(--transition),
		color var(--transition);
}

.sidebar-toggle:hover {
	background: var(--surface-3);
	color: var(--text);
}

/* --- Collapsed (desktop, opt-in) -------------------------------------------
 *
 * The sidebar stays visible by default on desktop, deliberately — hiding
 * primary navigation behind a hamburger on a 1400px screen costs a click on
 * every journey and hides destinations people have not learned yet, a
 * measurable regression for a tool staff live in all day. What it is
 * reasonable to want is more canvas for wide tables, so collapsing hides the
 * sidebar completely and reuses the exact off-canvas drawer already built for
 * tablet/mobile below: the hamburger (`.sidebar-toggle`, otherwise
 * mobile-only) becomes the way back in, with the same scrim and slide-in
 * transform. One drawer implementation, not two. The choice is remembered
 * per browser.
 */
.sidebar-collapse {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	color: var(--text-muted);
	flex-shrink: 0;
	transition:
		background var(--transition),
		color var(--transition);
}

.sidebar-collapse:hover {
	background: var(--surface-3);
	color: var(--text);
}

.app.is-collapsed .sidebar {
	position: fixed;
	inset: 0 auto 0 0;
	width: 264px;
	z-index: 60;
	transform: translateX(-100%);
	transition: transform var(--transition);
}

.app.is-collapsed .sidebar.is-open {
	transform: translateX(0);
	box-shadow: var(--shadow-lg);
}

.app.is-collapsed .sidebar-toggle {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
}

.app.is-collapsed .scrim {
	display: block;
	position: fixed;
	inset: 0;
	background: rgba(12, 37, 60, 0.45);
	z-index: 55;
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--transition);
}

.app.is-collapsed .scrim.is-open {
	opacity: 1;
	pointer-events: auto;
}

@media (max-width: 900px) {
	.app {
		grid-template-columns: 1fr;
	}

	.sidebar {
		position: fixed;
		inset: 0 auto 0 0;
		width: 264px;
		z-index: 60;
		transform: translateX(-100%);
		transition: transform var(--transition);
	}

	.sidebar.is-open {
		transform: translateX(0);
		box-shadow: var(--shadow-lg);
	}

	.sidebar-collapse {
		display: none;
	}

	.sidebar-toggle {
		display: grid;
		place-items: center;
		width: 36px;
		height: 36px;
		border-radius: var(--radius-sm);
		border: 1px solid var(--line);
	}

	.scrim {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(12, 37, 60, 0.45);
		z-index: 55;
		opacity: 0;
		pointer-events: none;
		transition: opacity var(--transition);
	}

	.scrim.is-open {
		opacity: 1;
		pointer-events: auto;
	}

	.page {
		padding: var(--space-5) var(--space-4) var(--space-7);
	}
}

/* --- Public / centred pages ------------------------------------------------ */
.public-shell {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.public-header {
	background: var(--gold);
	color: #fff;
	padding: var(--space-4) 0;
}

.public-header a {
	color: #fff;
}

.auth-shell {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: var(--space-5);
	background:
		radial-gradient(900px 460px at 12% -8%, var(--gold-tint), transparent 60%),
		var(--bg);
}

.auth-card {
	width: 100%;
	max-width: 400px;
}

/* --- Home — split portal chooser ------------------------------------------
   The only two audiences this site has, side by side, each card its own big
   link. No shared header above them on purpose — there is nothing to say
   that isn't already said better by picking one. */
.home-shell {
	min-height: 100vh;
	display: flex;
	align-items: center;
	padding: var(--space-6) var(--space-5);
	background: var(--bg);
}

.home-grid {
	width: 100%;
	max-width: 1180px;
	margin-inline: auto;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-6);
	min-height: min(680px, calc(100vh - var(--space-8)));
}

.home-card {
	position: relative;
	display: flex;
	flex-direction: column;
	color: var(--text);
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-sm);
	padding: var(--space-7) var(--space-6);
	transition:
		transform var(--transition),
		box-shadow var(--transition),
		border-color var(--transition);
}

.home-card:hover,
.home-card:focus-visible {
	text-decoration: none;
	color: var(--text);
	transform: translateY(-4px);
	box-shadow: var(--shadow-lg);
	border-color: var(--line-strong);
}

.home-card-icon {
	width: 104px;
	height: 104px;
	border-radius: var(--radius-full);
	display: grid;
	place-items: center;
	margin-bottom: var(--space-6);
	background: var(--gold-tint);
	color: var(--gold);
}

.home-card-icon svg {
	width: 58px;
	height: 58px;
}

.home-card-eyebrow {
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--gold);
}

.home-card-title {
	font-family: var(--font-display);
	font-size: clamp(1.6rem, 2.4vw, 2.1rem);
	margin-top: var(--space-2);
}

.home-card-desc {
	margin-top: var(--space-3);
	color: var(--text-soft);
	max-width: 42ch;
}

.home-card-list {
	list-style: none;
	margin-top: var(--space-5);
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.home-card-list li {
	display: flex;
	align-items: flex-start;
	gap: var(--space-2);
	font-size: 0.92rem;
	color: var(--text-soft);
}

.home-card-list svg {
	flex: none;
	width: 16px;
	height: 16px;
	margin-top: 0.2rem;
	color: var(--gold);
}

/* Pinned to the bottom regardless of list length, so both cards line up. */
.home-card-foot {
	margin-top: auto;
	padding-top: var(--space-6);
}

/* Decorative only — the whole card is the link, so this must never itself be
   an interactive target (no nested <a>, and no separate click zone to miss). */
.home-card-cta {
	pointer-events: none;
}

.home-card-cta svg {
	transition: transform var(--transition);
}

.home-card:hover .home-card-cta svg,
.home-card:focus-visible .home-card-cta svg {
	transform: translateX(4px);
}

/* Management — an inverted navy treatment, same shape language, so the split
   reads at a glance without needing a label. */
.home-card-navy {
	background: var(--navy);
	border-color: var(--navy);
	color: rgba(255, 255, 255, 0.92);
}

.home-card-navy:hover,
.home-card-navy:focus-visible {
	color: rgba(255, 255, 255, 0.92);
	border-color: var(--gold-soft);
}

.home-card-navy .home-card-desc {
	color: rgba(255, 255, 255, 0.72);
}

.home-card-navy .home-card-list li {
	color: rgba(255, 255, 255, 0.78);
}

.home-card-navy .home-card-eyebrow {
	color: var(--gold-soft);
}

.home-card-navy .home-card-icon {
	background: rgba(255, 255, 255, 0.1);
	color: var(--gold-soft);
}

.home-card-navy .home-card-list svg {
	color: var(--gold-soft);
}

/* `--navy` itself flips to a light tint in dark mode (it doubles as an accent
   text colour elsewhere), so the card needs its own fixed dark background
   rather than inheriting the token — the same problem the admin sidebar
   solves the same way. */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .home-card-navy {
		background: #10131a;
		border-color: #10131a;
	}
}
:root[data-theme="dark"] .home-card-navy {
	background: #10131a;
	border-color: #10131a;
}

@media (max-width: 900px) {
	.home-grid {
		grid-template-columns: 1fr;
		min-height: 0;
		gap: var(--space-5);
	}
	.home-card {
		padding: var(--space-6) var(--space-5);
		min-height: 460px;
	}
}

@media (max-width: 480px) {
	.home-shell {
		padding: var(--space-5) var(--space-4);
	}
	.home-card-icon {
		width: 84px;
		height: 84px;
		margin-bottom: var(--space-5);
	}
	.home-card-icon svg {
		width: 46px;
		height: 46px;
	}
}

/* --------------------------------------------------------------------------
   5. Components
   -------------------------------------------------------------------------- */

/* --- Card ----------------------------------------------------------------- */
.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
}

.card-pad {
	padding: var(--space-5);
}

.card-head {
	padding: var(--space-4) var(--space-5);
	border-bottom: 1px solid var(--line);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	flex-wrap: wrap;
}

.card-head h2,
.card-head h3 {
	font-size: 0.98rem;
	font-weight: 600;
}

.card-body {
	padding: var(--space-5);
}

.card-foot {
	padding: var(--space-3) var(--space-5);
	border-top: 1px solid var(--line);
	background: var(--surface-2);
	border-radius: 0 0 var(--radius) var(--radius);
}

.card-link {
	display: block;
	color: inherit;
	transition:
		border-color var(--transition),
		box-shadow var(--transition),
		transform var(--transition);
}

.card-link:hover {
	text-decoration: none;
	border-color: var(--line-strong);
	box-shadow: var(--shadow);
	transform: translateY(-1px);
}

/* --- Stat ----------------------------------------------------------------- */
.stat {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: var(--space-4) var(--space-5);
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	min-width: 0;
}

.stat .label {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.stat .value {
	font-size: 1.5rem;
	font-weight: 600;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
	line-height: 1.15;
}

.stat .hint {
	font-size: 0.8rem;
	color: var(--text-muted);
}

.stat.is-danger {
	border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
	background: linear-gradient(var(--danger-bg), var(--surface) 65%);
}

.stat.is-danger .value {
	color: var(--danger);
}

.stat.is-success .value {
	color: var(--success);
}

.stat.is-warn {
	border-color: color-mix(in srgb, var(--warn) 32%, var(--line));
}

/* --- Buttons -------------------------------------------------------------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	padding: 0.55rem 1.05rem;
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	font-size: 0.9rem;
	font-weight: 500;
	line-height: 1.3;
	white-space: nowrap;
	transition:
		background var(--transition),
		border-color var(--transition),
		color var(--transition),
		box-shadow var(--transition);
}

.btn:hover {
	text-decoration: none;
}

.btn:disabled,
.btn.is-disabled {
	opacity: 0.5;
	pointer-events: none;
}

.btn-primary {
	background: var(--navy);
	color: #fff;
	border-color: var(--navy);
}

.btn-primary:hover {
	background: color-mix(in srgb, var(--navy) 86%, #000);
	color: #fff;
}

:root[data-theme="dark"] .btn-primary,
.btn-primary {
	box-shadow: var(--shadow-sm);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .btn-primary {
		background: var(--gold);
		border-color: var(--gold);
		color: #16191d;
	}
	:root:not([data-theme="light"]) .btn-primary:hover {
		background: color-mix(in srgb, var(--gold) 88%, #fff);
		color: #16191d;
	}
}

.btn-gold {
	background: var(--gold);
	color: #fff;
	border-color: var(--gold);
}

.btn-gold:hover {
	background: color-mix(in srgb, var(--gold) 88%, #000);
	color: #fff;
}

.btn-secondary {
	background: var(--surface);
	color: var(--text);
	border-color: var(--line-strong);
}

.btn-secondary:hover {
	background: var(--surface-3);
	color: var(--text);
}

.btn-ghost {
	background: transparent;
	color: var(--text-soft);
	border-color: transparent;
}

.btn-ghost:hover {
	background: var(--surface-3);
	color: var(--text);
}

.btn-danger {
	background: var(--danger);
	color: #fff;
	border-color: var(--danger);
}

.btn-danger:hover {
	background: color-mix(in srgb, var(--danger) 86%, #000);
	color: #fff;
}

.btn-danger-ghost {
	background: transparent;
	color: var(--danger);
	border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

.btn-danger-ghost:hover {
	background: var(--danger-bg);
	color: var(--danger);
}

.btn-sm {
	padding: 0.32rem 0.7rem;
	font-size: 0.82rem;
}

.btn-lg {
	padding: 0.75rem 1.5rem;
	font-size: 1rem;
}

.btn-block {
	display: flex;
	width: 100%;
}

.btn-group {
	display: inline-flex;
	gap: var(--space-2);
	flex-wrap: wrap;
}

/* --- Badges --------------------------------------------------------------- */
.badge {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	padding: 0.15rem 0.55rem;
	border-radius: var(--radius-full);
	font-size: 0.74rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	white-space: nowrap;
	border: 1px solid transparent;
}

.badge::before {
	content: "";
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: currentColor;
	flex-shrink: 0;
}

.badge-plain::before {
	display: none;
}

.badge-success {
	background: var(--success-bg);
	color: var(--success);
}
.badge-warn {
	background: var(--warn-bg);
	color: var(--warn);
}
.badge-danger {
	background: var(--danger-bg);
	color: var(--danger);
}
.badge-info {
	background: var(--info-bg);
	color: var(--info);
}
.badge-muted {
	background: var(--surface-3);
	color: var(--text-muted);
}
.badge-gold {
	background: var(--gold-tint);
	color: var(--gold);
}

/* --- Tables --------------------------------------------------------------- */
.table-wrap {
	/* Wide tables scroll inside their own container; the page body must never
	   scroll sideways on a phone. */
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border-radius: var(--radius);
}

table.data {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.88rem;
	min-width: 560px;
}

table.data th {
	text-align: left;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--text-muted);
	padding: 0.65rem var(--space-4);
	background: var(--surface-2);
	border-bottom: 1px solid var(--line);
	white-space: nowrap;
	position: sticky;
	top: 0;
	z-index: 1;
}

table.data td {
	padding: 0.72rem var(--space-4);
	border-bottom: 1px solid var(--line);
	vertical-align: middle;
}

table.data tbody tr:last-child td {
	border-bottom: none;
}

table.data tbody tr {
	transition: background var(--transition);
}

table.data tbody tr:hover {
	background: var(--surface-2);
}

table.data tr.is-row-link {
	cursor: pointer;
}

table.data .cell-main {
	font-weight: 500;
	color: var(--text);
}

table.data .cell-sub {
	font-size: 0.79rem;
	color: var(--text-muted);
	margin-top: 0.1rem;
}

/* --- Definition list ------------------------------------------------------ */
.dl {
	display: grid;
	grid-template-columns: minmax(120px, auto) 1fr;
	gap: 0.55rem var(--space-4);
	font-size: 0.89rem;
}

.dl dt {
	color: var(--text-muted);
}

.dl dd {
	margin: 0;
	text-align: right;
	font-weight: 500;
}

.dl-left dd {
	text-align: left;
	font-weight: 400;
}

/* --- Forms ---------------------------------------------------------------- */
.field {
	display: flex;
	flex-direction: column;
	gap: 0.32rem;
}

.field + .field {
	margin-top: var(--space-4);
}

.field label,
.label {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--text-soft);
}

.field .hint {
	font-size: 0.78rem;
	color: var(--text-muted);
}

.field .error {
	font-size: 0.78rem;
	color: var(--danger);
	font-weight: 500;
}

.input,
.select,
.textarea {
	width: 100%;
	padding: 0.55rem 0.75rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text);
	font-size: 0.92rem;
	transition:
		border-color var(--transition),
		box-shadow var(--transition);
}

.input:focus,
.select:focus,
.textarea:focus {
	outline: none;
	border-color: var(--gold);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 18%, transparent);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
	background: var(--surface-3);
	color: var(--text-muted);
	cursor: not-allowed;
}

.input.has-error,
.select.has-error,
.textarea.has-error {
	border-color: var(--danger);
}

.textarea {
	min-height: 96px;
	resize: vertical;
	line-height: 1.55;
}

.select {
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b8f96' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.7rem center;
	padding-right: 2rem;
}

.input-group {
	display: flex;
}

.input-group .input {
	border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group .addon {
	display: grid;
	place-items: center;
	padding-inline: 0.7rem;
	background: var(--surface-3);
	border: 1px solid var(--line-strong);
	border-left: none;
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--text-muted);
}

.input-group .addon-lead {
	border-left: 1px solid var(--line-strong);
	border-right: none;
	border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group .addon-lead + .input {
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.checkbox,
.radio {
	display: flex;
	align-items: flex-start;
	gap: 0.55rem;
	font-size: 0.9rem;
	cursor: pointer;
	padding: 0.15rem 0;
}

.checkbox input,
.radio input {
	margin-top: 0.22rem;
	width: 16px;
	height: 16px;
	accent-color: var(--gold);
	flex-shrink: 0;
}

.fieldset {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: var(--space-4) var(--space-5) var(--space-5);
}

.fieldset legend {
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-muted);
	padding-inline: var(--space-2);
}

.form-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
	gap: var(--space-4);
}

.form-grid .field + .field {
	margin-top: 0;
}

.form-grid .span-2 {
	grid-column: span 2;
}

@media (max-width: 620px) {
	.form-grid .span-2 {
		grid-column: span 1;
	}
}

.form-actions {
	display: flex;
	gap: var(--space-3);
	align-items: center;
	flex-wrap: wrap;
	padding-top: var(--space-4);
	border-top: 1px solid var(--line);
	margin-top: var(--space-5);
}

/* --- Filter bar ----------------------------------------------------------- */
.filters {
	display: flex;
	gap: var(--space-3);
	align-items: flex-end;
	flex-wrap: wrap;
	margin-bottom: var(--space-4);
}

.filters .field {
	min-width: 150px;
}

.filters .field.grow {
	flex: 1;
	min-width: 210px;
}

/* --- Flash ---------------------------------------------------------------- */
.flash {
	display: flex;
	align-items: flex-start;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	font-size: 0.9rem;
	margin-bottom: var(--space-4);
}

.flash-success {
	background: var(--success-bg);
	color: var(--success);
	border-color: color-mix(in srgb, var(--success) 25%, transparent);
}
.flash-error {
	background: var(--danger-bg);
	color: var(--danger);
	border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}
.flash-warning {
	background: var(--warn-bg);
	color: var(--warn);
	border-color: color-mix(in srgb, var(--warn) 25%, transparent);
}
.flash-info {
	background: var(--info-bg);
	color: var(--info);
	border-color: color-mix(in srgb, var(--info) 25%, transparent);
}

.flash .close {
	margin-left: auto;
	opacity: 0.6;
	font-size: 1.1rem;
	line-height: 1;
}

/* --- Empty state ---------------------------------------------------------- */
.empty {
	text-align: center;
	padding: var(--space-7) var(--space-5);
	color: var(--text-muted);
}

.empty .icon {
	font-size: 1.9rem;
	margin-bottom: var(--space-3);
	opacity: 0.5;
}

.empty h3 {
	color: var(--text-soft);
	margin-bottom: var(--space-2);
}

.empty p {
	max-width: 400px;
	margin-inline: auto;
	font-size: 0.9rem;
}

.empty .btn {
	margin-top: var(--space-4);
}

/* --- Pagination ----------------------------------------------------------- */
.pagination {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	font-size: 0.85rem;
	color: var(--text-muted);
	flex-wrap: wrap;
}

.pagination .pages {
	display: flex;
	gap: var(--space-2);
}

/* --- Tabs ----------------------------------------------------------------- */
.tabs {
	display: flex;
	gap: var(--space-1);
	border-bottom: 1px solid var(--line);
	margin-bottom: var(--space-5);
	overflow-x: auto;
}

.tab {
	padding: 0.55rem var(--space-4);
	font-size: 0.88rem;
	font-weight: 500;
	color: var(--text-muted);
	border-bottom: 2px solid transparent;
	white-space: nowrap;
	transition:
		color var(--transition),
		border-color var(--transition);
}

.tab:hover {
	color: var(--text);
	text-decoration: none;
}

.tab.is-active {
	color: var(--gold);
	border-bottom-color: var(--gold);
}

/* --- Timeline ------------------------------------------------------------- */
.timeline {
	position: relative;
	padding-left: var(--space-5);
}

.timeline::before {
	content: "";
	position: absolute;
	left: 5px;
	top: 6px;
	bottom: 6px;
	width: 1px;
	background: var(--line);
}

.timeline-item {
	position: relative;
	padding-bottom: var(--space-4);
}

.timeline-item::before {
	content: "";
	position: absolute;
	left: calc(var(--space-5) * -1 + 1px);
	top: 6px;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--surface);
	border: 2px solid var(--line-strong);
}

.timeline-item.is-done::before {
	background: var(--success);
	border-color: var(--success);
}

.timeline-item.is-active::before {
	background: var(--gold);
	border-color: var(--gold);
}

/* --- Avatar --------------------------------------------------------------- */
.avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--gold-tint);
	color: var(--gold);
	display: grid;
	place-items: center;
	font-size: 0.78rem;
	font-weight: 700;
	flex-shrink: 0;
	overflow: hidden;
}

.avatar-sm {
	width: 26px;
	height: 26px;
	font-size: 0.68rem;
}

.avatar-lg {
	width: 48px;
	height: 48px;
	font-size: 1rem;
}

/* --- Thumb / cover -------------------------------------------------------- */
.thumb {
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	background: var(--surface-3);
	border-radius: var(--radius) var(--radius) 0 0;
}

.thumb-placeholder {
	display: grid;
	place-items: center;
	color: var(--text-muted);
	font-size: 1.6rem;
	background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
}

.thumb-sm {
	width: 52px;
	height: 40px;
	border-radius: var(--radius-sm);
	object-fit: cover;
	flex-shrink: 0;
}

/* --- Copy field ----------------------------------------------------------- */
.copy-field {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	background: var(--surface-2);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	padding: 0.5rem 0.55rem 0.5rem 0.8rem;
}

.copy-field .value {
	flex: 1;
	min-width: 0;
	font-family: var(--font-mono);
	font-size: 0.9rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	overflow-wrap: anywhere;
}

.copy-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	padding: 0.28rem 0.6rem;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line-strong);
	background: var(--surface);
	font-size: 0.76rem;
	font-weight: 600;
	color: var(--text-soft);
	flex-shrink: 0;
	transition: all var(--transition);
}

.copy-btn:hover {
	background: var(--gold-tint);
	border-color: var(--gold);
	color: var(--gold);
}

.copy-btn.is-copied {
	background: var(--success-bg);
	border-color: var(--success);
	color: var(--success);
}

/* --- Modal ---------------------------------------------------------------- */
dialog.modal {
	border: none;
	border-radius: var(--radius-lg);
	padding: 0;
	max-width: 520px;
	width: calc(100% - 2rem);
	background: var(--surface);
	color: var(--text);
	box-shadow: var(--shadow-lg);
}

dialog.modal::backdrop {
	background: rgba(12, 37, 60, 0.45);
	backdrop-filter: blur(2px);
}

dialog.modal .modal-head {
	padding: var(--space-5) var(--space-5) 0;
}

dialog.modal .modal-body {
	padding: var(--space-4) var(--space-5);
}

dialog.modal .modal-foot {
	padding: var(--space-4) var(--space-5) var(--space-5);
	display: flex;
	gap: var(--space-3);
	justify-content: flex-end;
	flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   6. Invoice
   --------------------------------------------------------------------------
   The single most important page in the system, and the one most often opened
   on a cheap phone over a weak connection.
   -------------------------------------------------------------------------- */
.invoice-page {
	max-width: 880px;
	margin-inline: auto;
	padding: var(--space-5) var(--space-4) var(--space-8);
}

.invoice-hero {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	overflow: hidden;
	box-shadow: var(--shadow);
}

.invoice-hero-top {
	padding: var(--space-5);
	/* background: linear-gradient(135deg, var(--navy), color-mix(in srgb, var(--navy) 78%, #000)); */
	background: var(--gold);
	color: #fff;
	display: flex;
	justify-content: space-between;
	gap: var(--space-4);
	flex-wrap: wrap;
}

.invoice-hero-top .org {
	font-family: var(--font-display);
	font-size: 1.2rem;
}

.invoice-hero-top .meta {
	font-size: 0.8rem;
	opacity: 0.75;
	margin-top: 0.15rem;
}

.amount-due {
	padding: var(--space-6) var(--space-5);
	text-align: center;
	border-bottom: 1px solid var(--line);
}

.amount-due .label {
	font-size: 0.74rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.amount-due .amount {
	font-size: clamp(2.1rem, 8vw, 2.9rem);
	font-weight: 600;
	letter-spacing: -0.03em;
	line-height: 1.1;
	margin: var(--space-2) 0;
	font-variant-numeric: tabular-nums;
}

.amount-due.is-paid .amount {
	color: var(--success);
}

.amount-due.is-overdue .amount {
	color: var(--danger);
}

.amount-due .due {
	font-size: 0.92rem;
	color: var(--text-soft);
}

/* --- Payment methods ------------------------------------------------------ */
.pay-methods {
	display: grid;
	gap: var(--space-4);
}

.pay-method {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--surface);
}

.pay-method.is-preferred {
	border-color: var(--gold);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 12%, transparent);
}

.pay-method-head {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-4);
	background: var(--surface-2);
	border-bottom: 1px solid var(--line);
}

.pay-method-head .icon {
	width: 34px;
	height: 34px;
	border-radius: var(--radius-sm);
	display: grid;
	place-items: center;
	background: var(--gold-tint);
	color: var(--gold);
	flex-shrink: 0;
}

.pay-method-head h3 {
	font-size: 0.95rem;
}

.pay-method-body {
	padding: var(--space-4);
	display: grid;
	gap: var(--space-3);
}

/* The USSD dial button. On a phone this is the whole flow: one tap opens the
   dialler with the merchant code and amount already entered. On a desktop it
   is inert, so it is hidden there and the QR takes its place. */
.momo-dial {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	padding: 0.85rem 1rem;
	border-radius: var(--radius);
	background: var(--gold);
	color: #fff;
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	box-shadow: var(--shadow);
	transition:
		transform var(--transition),
		background var(--transition);
}

.momo-dial:hover {
	color: #fff;
	text-decoration: none;
	background: color-mix(in srgb, var(--gold) 88%, #000);
}

.momo-dial:active {
	transform: scale(0.985);
}

/* --- QR handoff ----------------------------------------------------------- */
.qr-panel {
	display: flex;
	align-items: center;
	gap: var(--space-5);
	padding: var(--space-5);
	border: 1px dashed var(--line-strong);
	border-radius: var(--radius);
	background: var(--surface-2);
	flex-wrap: wrap;
}

.qr-panel .qr-code {
	width: 150px;
	height: 150px;
	background: #fff;
	padding: var(--space-2);
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
	flex-shrink: 0;
}

.qr-panel .qr-code svg {
	width: 100%;
	height: 100%;
	display: block;
}

.qr-panel .qr-copy {
	flex: 1;
	min-width: 200px;
}

.qr-panel h3 {
	font-size: 1rem;
	margin-bottom: var(--space-2);
}

/* --- Line items ----------------------------------------------------------- */
.line-items {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.line-items th {
	text-align: left;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-muted);
	padding-bottom: var(--space-2);
	border-bottom: 1px solid var(--line);
}

.line-items td {
	padding: 0.6rem 0;
	border-bottom: 1px solid var(--line);
	vertical-align: top;
}

.line-items .note {
	font-size: 0.78rem;
	color: var(--text-muted);
	margin-top: 0.15rem;
}

.line-items tfoot td {
	border-bottom: none;
	padding-top: var(--space-3);
}

.line-items tfoot .total td {
	font-size: 1.05rem;
	font-weight: 600;
	border-top: 2px solid var(--line-strong);
	padding-top: var(--space-3);
}

/* --------------------------------------------------------------------------
   7. Lease contract & e-signature
   -------------------------------------------------------------------------- */
.contract {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: clamp(var(--space-5), 5vw, var(--space-7));
	font-size: 0.94rem;
	line-height: 1.75;
	color: var(--text);
	max-width: 74ch;
	margin-inline: auto;
}

.contract h1 {
	font-family: var(--font-display);
	font-size: 1.45rem;
	text-align: center;
	margin-bottom: var(--space-2);
	letter-spacing: 0.01em;
}

.contract .meta {
	text-align: center;
	font-size: 0.8rem;
	color: var(--text-muted);
	margin-bottom: var(--space-6);
	padding-bottom: var(--space-4);
	border-bottom: 1px solid var(--line);
}

.contract h2 {
	font-size: 1rem;
	margin-top: var(--space-5);
	margin-bottom: var(--space-2);
	padding-bottom: 0.2rem;
	border-bottom: 1px solid var(--line);
}

.contract p {
	margin-bottom: var(--space-3);
}

.contract ul,
.contract ol {
	margin: 0 0 var(--space-3) var(--space-5);
}

.contract li {
	margin-bottom: var(--space-2);
}

.contract .attest {
	margin-top: var(--space-6);
	padding-top: var(--space-4);
	border-top: 1px solid var(--line);
	font-style: italic;
	color: var(--text-soft);
}

.sign-pad-wrap {
	border: 2px dashed var(--line-strong);
	border-radius: var(--radius);
	background: var(--surface-2);
	position: relative;
	overflow: hidden;
}

.sign-pad {
	display: block;
	width: 100%;
	height: 170px;
	touch-action: none;
	cursor: crosshair;
}

.sign-pad-hint {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: var(--text-muted);
	font-size: 0.88rem;
	pointer-events: none;
	transition: opacity var(--transition);
}

.sign-pad-wrap.has-ink .sign-pad-hint {
	opacity: 0;
}

.signature-block {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: var(--space-4);
	background: var(--surface-2);
}

.signature-block img {
	max-height: 66px;
	width: auto;
	filter: contrast(1.1);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .signature-block img {
		filter: invert(1) contrast(1.1);
	}
}

.signature-meta {
	font-size: 0.74rem;
	color: var(--text-muted);
	font-family: var(--font-mono);
	overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   8. Cleaning schedule
   -------------------------------------------------------------------------- */
.crew {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
	overflow: hidden;
}

.crew + .crew {
	margin-top: var(--space-5);
}

.crew-head {
	padding: var(--space-4) var(--space-5);
	background: linear-gradient(var(--gold-tint), var(--surface-2));
	border-bottom: 1px solid var(--line);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	flex-wrap: wrap;
}

.crew-head h2 {
	font-family: var(--font-display);
	font-size: 1.15rem;
}

.address-block {
	padding: var(--space-4) var(--space-5);
}

.address-block + .address-block {
	border-top: 1px solid var(--line);
}

.address-block .addr {
	font-weight: 600;
	font-size: 0.94rem;
	margin-bottom: 0.15rem;
}

.address-block .entry {
	font-size: 0.82rem;
	color: var(--text-muted);
	margin-bottom: var(--space-3);
}

.unit-list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	margin-top: var(--space-2);
}

.unit {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.3rem 0.65rem;
	border-radius: var(--radius-sm);
	font-size: 0.85rem;
	font-weight: 500;
	border: 1px solid var(--line);
	background: var(--surface-2);
}

.unit.is-checkout {
	background: var(--danger-bg);
	border-color: color-mix(in srgb, var(--danger) 25%, transparent);
	color: var(--danger);
	font-weight: 600;
}

.unit.is-checkin {
	background: var(--info-bg);
	border-color: color-mix(in srgb, var(--info) 25%, transparent);
	color: var(--info);
}

.unit.is-priority {
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 30%, transparent);
}

.legend {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
	font-size: 0.79rem;
	color: var(--text-muted);
}

.legend span {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
}

/* --------------------------------------------------------------------------
   9. Utilities
   -------------------------------------------------------------------------- */
.mt-0 {
	margin-top: 0;
}
.mt-1 {
	margin-top: var(--space-1);
}
.mt-2 {
	margin-top: var(--space-2);
}
.mt-3 {
	margin-top: var(--space-3);
}
.mt-4 {
	margin-top: var(--space-4);
}
.mt-5 {
	margin-top: var(--space-5);
}
.mt-6 {
	margin-top: var(--space-6);
}
.mb-0 {
	margin-bottom: 0;
}
.mb-2 {
	margin-bottom: var(--space-2);
}
.mb-3 {
	margin-bottom: var(--space-3);
}
.mb-4 {
	margin-bottom: var(--space-4);
}
.mb-5 {
	margin-bottom: var(--space-5);
}

.hidden {
	display: none !important;
}
.block {
	display: block;
}
.flex-1 {
	flex: 1;
}
.w-full {
	width: 100%;
}

.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;
}

/* Shown only on a phone / only on a desktop — used by the invoice page to
   swap the USSD dial button for the QR handoff. */
.mobile-only {
	display: none;
}

@media (max-width: 640px) {
	.mobile-only {
		display: block;
	}
	.desktop-only {
		display: none !important;
	}
}

/* --------------------------------------------------------------------------
   10. Print
   --------------------------------------------------------------------------
   Invoices and leases get printed and filed. Without this they print with a
   navy sidebar across every page and no margins.
   -------------------------------------------------------------------------- */
@media print {
	:root {
		--bg: #fff;
		--surface: #fff;
		--surface-2: #fff;
		--surface-3: #fff;
		--text: #000;
		--text-soft: #333;
		--text-muted: #666;
		--line: #ccc;
		--line-strong: #999;
	}

	body {
		background: #fff;
		font-size: 11pt;
	}

	.sidebar,
	.topbar,
	.no-print,
	.btn,
	.flash,
	.tabs,
	.pagination,
	.filters {
		display: none !important;
	}

	.app {
		display: block;
	}

	.page,
	.invoice-page {
		padding: 0;
		max-width: none;
	}

	.card,
	.invoice-hero,
	.contract,
	.pay-method {
		border: 1px solid #ccc;
		box-shadow: none;
		break-inside: avoid;
	}

	.invoice-hero-top {
		background: #fff !important;
		color: #000 !important;
		border-bottom: 2px solid #000;
	}

	.qr-panel {
		break-inside: avoid;
	}

	/* A printed page cannot scroll — `overflow-x: auto` only hides the
	   scrollbar, it does not stop clipping whatever sits past the visible
	   edge. Without this, a wide ledger or payment-history table loses its
	   right-most columns (balance, amount) on every "Print / PDF" export. */
	.table-wrap {
		overflow: visible;
	}

	/* Signature images are inverted in dark mode so black ink stays visible
	   against a dark card (see the `.signature-block img` dark-mode rule
	   above). Print always renders on a white page regardless of the
	   OS/browser theme, so an inverted signature becomes white-on-white —
	   invisible on the one page it matters most, a signed lease. */
	.signature-block img {
		filter: contrast(1.1) !important;
	}

	a[href^="http"]::after {
		content: " (" attr(href) ")";
		font-size: 8pt;
		color: #666;
	}

	/* The dial link and copy buttons mean nothing on paper. */
	a[href^="tel:"]::after {
		content: none;
	}
}
