/* =================================================================
   style.css — the application's own styles, on top of Bootstrap 6.

   bootstrap.min.css is the unmodified distribution file and is never
   edited. This file adds what Bootstrap does not have: the app shell
   (a pinned sidebar) and the application's own components. ui.css,
   loaded after it, holds the few values that brand an installation.

   Conventions:
     - Everything is inside `@layer custom`. Bootstrap 6 orders its CSS
       in cascade layers and reserves that one for the project:
       it beats Bootstrap's components and loses to its utility
       classes — so `class="list-bar mb-0"` behaves as written.
       A rule OUTSIDE a layer would beat even the utilities.
     - Colours come from Bootstrap's tokens (--bs-bg-body, --bs-bg-1,
       --bs-fg-body, --bs-fg-3, --bs-border-color, --bs-primary-bg…).
       They are light-dark() values and follow the colour mode by
       themselves: a rule written with them is right in light AND
       dark. Never a fixed colour.
     - Light / dark is Bootstrap's [data-bs-theme] on <html>. The
       toggle is in script.js; theme-boot.js applies the saved choice
       before the first paint.
     - No `style=""` in views: a named class here instead.
     - Breakpoints are Bootstrap's: sm 576, md 768, lg 1024, xl 1280.
   ================================================================= */

/* Layout tokens (ui.css overrides them per installation). Custom
   properties are not layered: the later declaration wins. */
:root {
	--app-sidebar-width: 16rem;
	--app-content-max-width: none;
}

@layer custom {

	/* =============================================================
	   Page ground and type. The page is a very light grey and the
	   cards on it are white, so content reads as sheets on a desk;
	   the sidebar is white too. Headings use the rounder heading
	   font (ui.css), figures line up in columns.
	   ============================================================= */

	body {
		background: var(--bs-bg-1);
	}

	h1, h2, h3, h4, .h1, .h2, .h3, .h4, .card-title, .dialog-title, .drawer-title {
		font-family: var(--app-heading-font);
		letter-spacing: -0.015em;
	}

	/* Money, quantities, document numbers: equal-width digits, never wrapped. */
	.num {
		font-variant-numeric: tabular-nums;
		white-space: nowrap;
	}

	td.num,
	th.num {
		text-align: end;
	}

	/* =============================================================
	   The logo — the Logo partial: the company's mark (drawn by the
	   Brand controller in the primary colour), then its name.
	   ============================================================= */

	.app-logo {
		display: inline-flex;
		align-items: center;
		gap: 0.625rem;
		color: var(--bs-fg-body);
		font-family: var(--app-heading-font);
		font-size: 1.1875rem;
		font-weight: 800;
		letter-spacing: -0.025em;
		line-height: 1.2;
	}

	.app-logo-link {
		color: inherit;
		text-decoration: none;
	}

	.app-logo-mark {
		flex: 0 0 auto;
		width: 2rem;
		height: 2rem;
	}

	.app-logo-name {
		overflow-wrap: anywhere;
	}

	/* =============================================================
	   App shell — SidebarDashboard / HeaderDashboard.

	   The sidebar is Bootstrap's responsive drawer (.lg:drawer on a
	   <dialog>): below lg it slides in over the page; from lg up
	   Bootstrap renders it in place, and the rules below pin its
	   wrapper to the left edge and move the content over.
	   ============================================================= */

	.app-mobilebar {
		position: sticky;
		top: 0;
		z-index: var(--bs-z-sticky);
		height: 3.5rem;      /* said outright: .app-content below is the window less this */
	}

	/* The content's padding is three variables, because the top bar inside it
	   reaches the edges by taking the same amounts back. --app-pad-end is what
	   keeps the content from stretching on a very wide screen
	   (--app-content-max-width): the width is not capped, the right padding grows. */
	.app-content {
		--app-pad-x: 1rem;
		--app-pad-y: 1rem;
		--app-pad-end: var(--app-pad-x);
		min-width: 0;
		min-height: calc(100dvh - 3.5rem);      /* at least the window, so the footer sits at its bottom */
		padding: var(--app-pad-y) var(--app-pad-end) var(--app-pad-y) var(--app-pad-x);
	}

	/* The top bar (NavbarDashboard): a band of the body's own colour across
	   the top of the content, edge to edge, with a line under it — the page's
	   title in the heading weight on the left, the controls on the right. */
	.app-header {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		gap: 0.5rem 1rem;
		margin: calc(-1 * var(--app-pad-y)) calc(-1 * var(--app-pad-end)) var(--app-pad-y) calc(-1 * var(--app-pad-x));
		padding: 0.75rem var(--app-pad-x);
		border-bottom: 1px solid var(--bs-border-color);
		background: var(--bs-bg-body);
	}

	.app-header-title {
		flex: 1 1 8rem;      /* on a phone the controls stay beside a short title */
		min-width: 0;
	}

	.app-header-title h1 {
		margin: 0;
		font-size: 1.25rem;
		font-weight: 800;
		line-height: 1.25;
		letter-spacing: -0.01em;
		overflow-wrap: anywhere;
	}

	.app-header-subtitle {
		margin: 0.125rem 0 0;
		color: var(--bs-fg-2);
		font-size: 0.8125rem;
	}

	.app-controls {
		display: flex;
		flex: 0 0 auto;
		align-items: center;
		gap: 0.5rem;
	}

	/* The menu: 18rem wide. Below lg it slides in over the page as a PLAIN
	   panel — flush with the edge, square, on a page that is simply dimmed.
	   (Bootstrap's drawer is a floating rounded card over a blurred backdrop:
	   every one of those defaults is switched off here.) */
	#sidebarMenu {
		--bs-drawer-width: 18rem;
		--bs-drawer-inset: 0px;
		--bs-drawer-border-radius: 0;
		--bs-drawer-border-width: 0;
		--bs-drawer-box-shadow: none;
		--bs-drawer-backdrop-bg: #000;      /* a scrim is black in light and in dark */
		--bs-drawer-backdrop-opacity: 45%;
		--bs-drawer-backdrop-blur: 0px;
		color: var(--bs-fg-body);
	}

	#sidebarMenu .drawer-header {
		border-bottom: 1px solid var(--bs-border-color);
	}

	/* Nothing in this application blurs what is behind it: a dialog (the
	   command palette, a remote modal) dims the page and no more. */
	.dialog {
		--bs-dialog-backdrop-blur: 0px;
	}
	.sidebar-body {
		flex-direction: column;
		gap: 1.25rem;
		padding: 1rem 0.75rem;
	}

	.sidebar-brand {
		padding: 0.25rem 0.75rem 0.5rem;
	}

	.sidebar-nav {
		--bs-nav-link-justify: flex-start;
		--bs-nav-link-gap: 0.75rem;
		--bs-nav-link-padding-y: 0.5rem;
		--bs-nav-link-color: var(--bs-fg-1);
		--bs-nav-link-hover-color: var(--bs-fg-body);
		--bs-nav-link-hover-bg: var(--bs-bg-3);
		--bs-nav-link-active-color: var(--bs-primary-fg-emphasis);
		--bs-nav-link-active-bg: var(--bs-primary-bg-subtle);
		flex-direction: column;
		flex-wrap: nowrap;
	}

	/* A menu entry is a band across the whole sidebar: it takes back the
	   sidebar's side padding (.sidebar-body), is square, and keeps its text
	   where it was by padding as much more. */
	.sidebar-nav .nav-link {
		--bs-nav-link-border-width: 0;
		position: relative;
		width: calc(100% + 1.5rem);
		margin-inline: -0.75rem;
		padding: calc(var(--bs-nav-link-padding-y) + 1px) 1.5rem;
		border-radius: 0;
		white-space: normal;
	}

	/* The current page: tinted, bold, with a bar in the brand's pure red down its whole left edge. */
	.sidebar-nav .nav-link.active {
		font-weight: 600;
	}

	.sidebar-nav .nav-link.active::before {
		content: "";
		position: absolute;
		inset-block: 0;
		inset-inline-start: 0;
		width: 3px;
		background: var(--bs-primary-base);
	}

	.sidebar-nav .nav-link.active .sidebar-icon {
		color: var(--bs-primary-fg);
	}

	.sidebar-icon {
		flex: 0 0 auto;
		width: 1.25rem;
		text-align: center;
	}

	.sidebar-heading {
		margin-bottom: -0.75rem;
		padding: 0 0.75rem;
		color: var(--bs-fg-3);
		font-size: 0.75rem;
		font-weight: 600;
		letter-spacing: 0.04em;
		text-transform: uppercase;
	}

	.sidebar-foot {
		margin-top: auto;
	}

	.sidebar-user {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		min-width: 0;
		padding: 0 0.25rem 0.75rem;
		font-weight: 600;
	}

	.sidebar-user-name {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	/* One menu per area of the application (the Shell class): the page's own
	   shows, the others carry [hidden]. A menu fills the sidebar, so its
	   last list can stand at the foot (.sidebar-nav-end: Settings). */
	.sidebar-menu {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
		gap: 1.25rem;
	}

	.sidebar-nav-end {
		margin-top: auto;
	}

	/* The head of an area's menu: the way back, then the area's name. */
	.sidebar-area {
		display: flex;
		flex-direction: column;
		gap: 0.5rem;
	}

	.sidebar-back {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		padding: 0.375rem 0.75rem;
		border-radius: var(--bs-radius-5);
		color: var(--bs-fg-3);
		font-size: 0.875rem;
		text-decoration: none;
	}

	.sidebar-back:hover,
	.sidebar-back:focus-visible {
		background: var(--bs-bg-3);
		color: var(--bs-fg-body);
	}

	.sidebar-title {
		padding: 0 0.75rem;
		font-family: var(--app-heading-font);
		font-size: 1.125rem;
		font-weight: 700;
	}

	@media (width >= 1024px) {
		.sidebar {
			position: fixed;
			inset-block: 0;
			inset-inline-start: 0;
			z-index: var(--bs-z-fixed);
			display: flex;
			flex-direction: column;
			width: var(--app-sidebar-width);
			overflow-y: auto;
			background: var(--bs-bg-body);
			border-inline-end: 1px solid var(--bs-border-color);
		}

		/* Tells Bootstrap's script the drawer is shown in place here (it reads
		   this property to stop treating the element as a closed dialog). */
		#sidebarMenu {
			--drawer-inline: 1;
		}

		.sidebar-body {
			min-height: 100vh;
		}

		.app-content {
			--app-pad-x: 1.75rem;
			--app-pad-y: 1.25rem;
			--app-pad-end: max(var(--app-pad-x), calc(100vw - var(--app-sidebar-width) - var(--app-content-max-width) + var(--app-pad-x)));
			margin-inline-start: var(--app-sidebar-width);
		}

		/* The top bar stays in view; a long title wraps beside the controls. */
		.app-header {
			position: sticky;
			top: 0;
			z-index: var(--bs-z-sticky);
			flex-wrap: nowrap;
			min-height: 4.25rem;
			padding-inline-end: var(--app-pad-x);
		}

		.app-header-title h1 {
			font-size: 1.375rem;
		}

		/* Search reads as a field to type in — it opens the palette. */
		.navbar-search {
			justify-content: flex-start;
			gap: 0.5rem;
			min-width: 15rem;
			border: 1px solid var(--bs-border-color);
			background: var(--bs-bg-1);
			color: var(--bs-fg-2);
			font-weight: 400;
		}

		.navbar-search:hover,
		.navbar-search:focus-visible {
			background: var(--bs-bg-2);
		}

		.navbar-search kbd {
			margin-inline-start: auto;
		}	}

	/* The search button of the top bar, and the keys shown next to shortcuts. */
	.navbar-search kbd,
	.command-palette kbd {
		padding: 0.1rem 0.35rem;
		border: 1px solid var(--bs-border-color);
		border-radius: var(--bs-radius-3);
		background: var(--bs-bg-body);
		color: var(--bs-fg-3);
		font-size: 0.7rem;
	}

	.user-menu-toggle {
		--bs-btn-padding-x: 0.375rem;
	}

	/* The theme toggle shows the icon of the mode it switches TO. */
	.theme-icon-light,
	[data-bs-theme="dark"] .theme-icon-dark {
		display: none;
	}

	[data-bs-theme="dark"] .theme-icon-light {
		display: inline-block;
	}

	/* The foot of a dashboard page (FooterDashboardElement): the counterpart
	   of the top bar — a band of the body's colour, edge to edge, with a line
	   over it. `top: 100vh` on a sticky element is what puts it at the bottom
	   of the window when the page is shorter than the window (.app-content is
	   at least that tall); on a longer page it is simply last. */
	.app-footer {
		position: sticky;
		top: 100vh;
		margin: calc(var(--app-pad-y) * 1.5) calc(-1 * var(--app-pad-end)) calc(-1 * var(--app-pad-y)) calc(-1 * var(--app-pad-x));
		padding: 0.75rem var(--app-pad-x);
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: center;
		gap: 0.25rem 1rem;
		border-top: 1px solid var(--bs-border-color);
		background: var(--bs-bg-body);
		color: var(--bs-fg-3);
		font-size: 0.8125rem;
	}

	/* Who built it, at the right end of the footer. */
	.app-footer-credit {
		font-weight: 600;
	}

	@media (width >= 1024px) {
		.app-content {
			min-height: 100vh;
		}

		.app-footer {
			justify-content: space-between;
		}
	}

	/* What scrolls into view — an address that ends in #part, a field that takes
	   the focus — stops BELOW the bar that stays at the top (the mobile bar; from
	   lg up the top bar, which is two lines tall under a long title). */
	:root {
		scroll-padding-top: 4.5rem;
	}

	@media (width >= 1024px) {
		:root {
			scroll-padding-top: 6.5rem;
		}
	}

	/* The pages outside the dashboard (sign in, register): one card, centred. */
	.auth-page {
		min-height: 100vh;
	}

	.auth-card {
		width: 100%;
		max-width: 30rem;
	}

	.auth-card .app-logo {
		font-size: 1.375rem;
	}

	.auth-card .app-logo-mark {
		width: 2.5rem;
		height: 2.5rem;
	}

	/* =============================================================
	   Initials avatar — <span class="avatar-initials">A</span>.
	   Sizes: -sm (table rows, the top bar), default, -lg (profile).
	   ============================================================= */

	.avatar-initials {
		display: inline-flex;
		flex: 0 0 auto;
		align-items: center;
		justify-content: center;
		width: 2.5rem;
		height: 2.5rem;
		border-radius: 50%;
		background: var(--bs-primary-bg);
		color: var(--bs-primary-contrast);
		font-weight: 600;
		line-height: 1;
		text-transform: uppercase;
	}

	.avatar-initials-sm {
		width: 1.75rem;
		height: 1.75rem;
		font-size: 0.75rem;
	}

	.avatar-initials-lg {
		width: 5rem;
		height: 5rem;
		font-size: 1.75rem;
	}

	/* =============================================================
	   Cards. Bootstrap 6 lays a card's header out as a column; a
	   header with a title on the left and an action on the right
	   says so with .card-header-row.
	   ============================================================= */

	.card-header-row {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		gap: 0.5rem;
	}

	.card-title {
		margin-bottom: 0;
		font-size: 1rem;
		font-weight: 600;
	}

	/* =============================================================
	   The home page: a greeting, then the figures the modules offer
	   (DashboardCards) — one .kpi each.

	     <div class="kpi kpi-danger">
	       <span class="kpi-icon"><span class="fas fa-box"></span></span>
	       <div class="kpi-body">
	         <a class="kpi-label kpi-link" href="…">Label</a>     (or a <span class="kpi-label">)
	         <div class="kpi-value num">128<small class="kpi-unit">ден.</small></div>
	         <div class="kpi-hint">A line under it</div>
	       </div>
	     </div>

	   The label is the link and covers the whole card. A tone
	   (kpi-success | -warning | -danger | -info) colours the icon only:
	   the figure stays in ink.
	   ============================================================= */

	.home-hello {
		display: flex;
		flex-wrap: wrap;
		align-items: baseline;
		justify-content: space-between;
		gap: 0.25rem 1rem;
		margin-bottom: 1.25rem;
	}

	.home-hello-title {
		margin: 0;
		font-size: 1.5rem;
		font-weight: 700;
		overflow-wrap: anywhere;
	}

	.home-hello-date {
		color: var(--bs-fg-3);
	}

	.kpi {
		--kpi-tint: var(--bs-primary-bg-subtle);
		--kpi-ink: var(--bs-primary-fg);
		position: relative;
		display: flex;
		align-items: flex-start;
		gap: 0.875rem;
		height: 100%;
		padding: 1.125rem 1.25rem;
		border: 1px solid var(--bs-border-color);
		border-radius: var(--bs-radius-7);
		background: var(--bs-bg-body);
		transition: border-color 0.15s ease, box-shadow 0.15s ease;
	}

	.kpi:has(.kpi-link):hover {
		border-color: var(--bs-primary-border);
		box-shadow: var(--bs-box-shadow-sm);
	}

	.kpi:has(.kpi-link:focus-visible) {
		border-color: var(--bs-primary-border);
		box-shadow: 0 0 0 0.25rem var(--bs-primary-focus-ring);
	}

	.kpi-success {
		--kpi-tint: var(--bs-success-bg-subtle);
		--kpi-ink: var(--bs-success-fg);
	}

	.kpi-warning {
		--kpi-tint: var(--bs-warning-bg-subtle);
		--kpi-ink: var(--bs-warning-fg);
	}

	.kpi-danger {
		--kpi-tint: var(--bs-danger-bg-subtle);
		--kpi-ink: var(--bs-danger-fg);
	}

	.kpi-info {
		--kpi-tint: var(--bs-info-bg-subtle);
		--kpi-ink: var(--bs-info-fg);
	}

	.kpi-icon {
		display: inline-flex;
		flex: 0 0 auto;
		align-items: center;
		justify-content: center;
		width: 2.5rem;
		height: 2.5rem;
		border-radius: var(--bs-radius-5);
		background: var(--kpi-tint);
		color: var(--kpi-ink);
	}

	.kpi-body {
		display: flex;
		flex-direction: column;
		gap: 0.125rem;
		min-width: 0;
	}

	.kpi-label {
		color: var(--bs-fg-2);
		font-size: 0.8125rem;
		font-weight: 500;
		text-decoration: none;
	}

	.kpi-link:focus-visible {
		outline: none;
	}

	/* The label is the link; this makes the whole card its target. */
	.kpi-link::after {
		content: "";
		position: absolute;
		inset: 0;
		border-radius: inherit;
	}

	.kpi-value {
		font-family: var(--app-heading-font);
		font-size: 1.625rem;
		font-weight: 700;
		line-height: 1.2;
	}

	.kpi-unit {
		margin-inline-start: 0.375rem;
		color: var(--bs-fg-3);
		font-size: 0.875rem;
		font-weight: 500;
	}

	.kpi-hint {
		color: var(--bs-fg-3);
		font-size: 0.8125rem;
	}

	/* =============================================================
	   Forms.
	   ============================================================= */

	/* A form (or one field) that should not stretch across a wide card. */
	.form-narrow {
		max-width: 28rem;
	}

	/* A select that is only as wide as its content (filters, per-row actions). */
	.form-control-auto {
		width: auto;
	}

	/* Rows added by .auto-option (script.js); the placeholder while dragging ([data-sortable]). */
	.sortable-placeholder {
		min-height: 2.25rem;
		border: 1px dashed var(--bs-border-color);
		background: var(--bs-bg-1);
	}

	/* =============================================================
	   The flash message (Alert partial) and the one button it can
	   carry (Alert::Action — "Undo").
	   ============================================================= */

	.alert {
		align-items: center;
	}

	.alert-text {
		flex: 1 1 auto;
		min-width: 0;
	}

	.alert-action {
		flex: 0 0 auto;
		margin: 0;
	}

	/* =============================================================
	   Confirm popover ([data-confirm]).
	   ============================================================= */

	.zo-confirm-popover .popover-body {
		min-width: 13.75rem;
	}

	.zo-confirm-popover .zo-confirm-actions {
		display: flex;
		gap: 0.5rem;
	}

	/* =============================================================
	   Global toast — ZO.toast(text, color) from script.js. The colour
	   is a Bootstrap theme class (theme-success…) on the element.
	   ============================================================= */

	#zo-toast {
		position: fixed;
		right: 1rem;
		bottom: 1rem;
		z-index: var(--bs-z-toast);
		padding: 0.75rem 1rem;
		border-radius: var(--bs-radius-5);
		background: var(--bs-theme-bg, var(--bs-primary-bg));
		color: var(--bs-theme-contrast, var(--bs-primary-contrast));
		box-shadow: var(--bs-box-shadow-lg);
		opacity: 0;
		transform: translateY(8px);
		transition: opacity 0.18s ease, transform 0.18s ease;
		pointer-events: none;
	}

	#zo-toast.show {
		opacity: 1;
		transform: translateY(0);
	}

	#zo-toast.has-action {
		pointer-events: auto;
	}

	#zo-toast a {
		margin-left: 0.75rem;
		color: inherit;
		font-weight: 600;
		text-decoration: underline;
	}

	/* =============================================================
	   List pages — one pattern for every page with a table, filters
	   and actions (Products.view.html is the reference markup):

	     .list-head      page actions, right-aligned (main button first)
	     form.list-bar   the filter form, inside the "filters" live region
	       .list-filters   one row of .list-field items + ListBarEnd partial
	       .list-more      secondary fields, folded behind "More filters"
	     .list-tabs      optional row of tabs / quick views
	     .list-card      the results card, inside the "results" live region
	   ============================================================= */

	.list-head {
		display: flex;
		align-items: center;
		justify-content: flex-end;
		gap: 0.75rem;
		margin-bottom: 1rem;
	}

	.list-actions {
		display: flex;
		flex-wrap: wrap;
		gap: 0.5rem;
	}

	.list-bar {
		margin-bottom: 1rem;
		padding: 0.75rem;
		border: 1px solid var(--bs-border-color);
		border-radius: var(--bs-radius-7);
		background: var(--bs-bg-body);
	}

	.list-filters,
	.list-more {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 0.75rem;
	}

	.list-more {
		display: none;
		margin-top: 0.75rem;
		padding-top: 0.75rem;
		border-top: 1px dashed var(--bs-border-color);
	}

	.list-bar.list-more-open .list-more {
		display: flex;
	}

	.list-field {
		position: relative;
		flex: 0 1 12.5rem;
		min-width: 8.75rem;
	}

	.list-field-wide {
		flex: 1 1 16.25rem;
	}

	.list-field-icon {
		position: absolute;
		top: 50%;
		left: 0.85rem;
		z-index: 1;
		color: var(--bs-fg-3);
		transform: translateY(-50%);
		pointer-events: none;
	}

	.list-field-icon + .form-control {
		padding-left: 2.4rem;
	}

	.list-bar-end {
		display: flex;
		align-items: center;
		gap: 0.25rem;
		margin-left: auto;
	}

	.list-more-count {
		display: inline-block;
		min-width: 1.25rem;
		padding: 0 0.35rem;
		border-radius: 1rem;
		background: var(--bs-primary-bg);
		color: var(--bs-primary-contrast);
		font-size: 0.75rem;
		line-height: 1.25rem;
		text-align: center;
	}

	.list-tabs {
		display: flex;
		gap: 0.25rem;
		margin: 0 0 1rem;
		overflow-x: auto;
		scrollbar-width: thin;
	}

	.list-tab {
		display: inline-flex;
		align-items: center;
		padding: 0.4rem 0.8rem;
		border: 1px solid transparent;
		border-radius: var(--bs-radius-5);
		color: var(--bs-fg-2);
		text-decoration: none;
		white-space: nowrap;
	}

	.list-tab:hover {
		background: var(--bs-bg-2);
		color: var(--bs-fg-body);
	}

	.list-tab.active {
		border-color: var(--bs-border-color);
		background: var(--bs-bg-body);
		color: var(--bs-fg-body);
		font-weight: 600;
	}

	.list-tab-count {
		margin-left: 0.4rem;
		padding: 0 0.4rem;
		border-radius: 1rem;
		background: var(--bs-bg-3);
		font-size: 0.75rem;
	}

	.list-check {
		width: 1%;
		padding-right: 0 !important;
	}

	.list-narrow {
		width: 1%;
		white-space: nowrap;
	}

	/* A picture beside the name in a row (the products list): `.list-media`
	   holds a `.list-thumb` and the link. */
	.list-media {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		min-width: 0;
	}

	.list-thumb {
		flex: 0 0 auto;
		width: 2.75rem;
		height: 2.75rem;
		border: 1px solid var(--bs-border-color);
		border-radius: var(--bs-radius-3);
		object-fit: contain;
		background: #fff;      /* product pictures are cut out for white: also in dark mode */
	}

	.list-thumb-empty {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		background: var(--bs-bg-1);
		color: var(--bs-fg-4);
	}

	/* The results card clips its table to the card's rounded corners. */
	.list-card {
		overflow: hidden;
	}

	/* A table that fills a card edge to edge: roomier cells, a tinted head
	   (through Bootstrap's own table variable, so it follows the colour mode). */
	.list-table {
		--bs-table-cell-padding-x: 1rem;
		--bs-table-cell-padding-y: 0.75rem;
		margin-bottom: 0;
	}

	.list-table > thead {
		--bs-table-bg: var(--bs-bg-1);
		color: var(--bs-fg-2);
		font-size: 0.8125rem;
		white-space: nowrap;
	}

	.list-table > tbody > tr:last-child > * {
		border-bottom-width: 0;
	}

	/* A table full of links: they are in ink, not in the brand's red — a
	   column of red titles would shout. The one being pointed at turns red
	   and is underlined. */
	.list-table a:not([class*="btn-"]) {
		color: var(--bs-fg-body);
		font-weight: 500;
		text-decoration: none;
	}

	.list-table a:not([class*="btn-"]):hover,
	.list-table a:not([class*="btn-"]):focus-visible {
		color: var(--bs-primary-fg);
		text-decoration: underline;
	}

	/* Reference tables (ReferenceList / ReferenceForm): a yes mark, and a tick box with its label. */
	.reference-yes {
		color: var(--bs-success-fg);
	}

	.reference-check {
		display: flex;
		align-items: center;
		gap: 0.625rem;
	}

	/* A heading row inside a table body (the roles matrix, grouped lists). */
	.list-table .roles-group > th {
		--bs-table-bg: var(--bs-bg-1);
		padding-block: 0.5rem;
		color: var(--bs-fg-2);
		font-size: 0.75rem;
		font-weight: 600;
		letter-spacing: 0.04em;
		text-transform: uppercase;
	}

	/* Sortable column headers: th[data-sort] inside table[data-sort-key][data-sort-dir]. */
	.list-table th[data-sort] {
		cursor: pointer;
		user-select: none;
	}

	.list-table th[data-sort]::after {
		content: "\2195";
		margin-left: 0.35rem;
		opacity: 0.3;
	}

	.list-table th[data-sort][aria-sort="ascending"]::after {
		content: "\2191";
		opacity: 1;
	}

	.list-table th[data-sort][aria-sort="descending"]::after {
		content: "\2193";
		opacity: 1;
	}

	.list-table th[data-sort]:focus-visible {
		outline: 2px solid var(--bs-primary-focus-ring);
		outline-offset: -2px;
	}

	/* Search-term highlight ([data-search-highlight]). */
	mark.zo-highlight {
		padding: 0;
		background: var(--bs-warning-bg-muted);
		color: inherit;
	}

	/* Phones: one filter stays visible, the rest fold; table rows become cards. */
	@media (width < 768px) {
		.list-filters .list-field:not(.list-field-keep) {
			display: none;
		}

		.list-bar.list-more-open .list-filters .list-field {
			display: block;
			flex: 1 1 100%;
		}

		.list-more .list-field {
			flex: 1 1 100%;
		}

		.list-actions {
			flex-wrap: nowrap;
			overflow-x: auto;
			scrollbar-width: none;
		}

		.list-table > thead {
			display: none;
		}

		.list-table,
		.list-table > tbody,
		.list-table > tbody > tr,
		.list-table > tbody > tr > td {
			display: block;
			width: 100%;
		}

		.list-table > tbody > tr {
			padding: 0.5rem 0;
			border-bottom: 1px solid var(--bs-border-color);
		}

		.list-table > tbody > tr > td {
			padding: 0.25rem 1rem;
			border-bottom-width: 0;
			text-align: left !important;
			white-space: normal;
		}

		.list-table td[data-label]::before {
			content: attr(data-label);
			display: inline-block;
			min-width: 6.5rem;
			color: var(--bs-fg-3);
			font-size: 0.8rem;
		}

		.list-table td.list-narrow:empty,
		.list-table td.list-media-cell::before {
			display: none;      /* a picture and a name need no label */
		}
	}

	/* =============================================================
	   Empty state — the EmptyState partial.
	   ============================================================= */

	.empty-state {
		padding: 3rem 1rem;
		border: 1px dashed var(--bs-border-color);
		border-radius: var(--bs-radius-7);
		background: var(--bs-bg-body);
		text-align: center;
	}

	.empty-state-icon {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 3.5rem;
		height: 3.5rem;
		margin-bottom: 1rem;
		border-radius: 50%;
		background: var(--bs-bg-2);
		color: var(--bs-fg-3);
		font-size: 1.4rem;
	}

	.empty-state-title {
		margin-bottom: 0.35rem;
		font-size: 1.15rem;
	}

	.empty-state-text {
		margin-bottom: 1rem;
		color: var(--bs-fg-3);
	}

	/* =============================================================
	   Notifications — the bell in the top bar, its menu, and the
	   items (NotificationItems partial; the inbox reuses them).
	   ============================================================= */

	.notification-bell {
		position: relative;
		overflow: visible;
	}

	.notification-badge {
		position: absolute;
		top: -0.35rem;
		right: -0.35rem;
		min-width: 1.1rem;
		padding: 0 0.3rem;
		border-radius: 1rem;
		background: var(--bs-primary-bg);
		color: var(--bs-primary-contrast);
		font-size: 0.68rem;
		font-weight: 700;
		line-height: 1.1rem;
		text-align: center;
	}

	.notification-badge[hidden] {
		display: none;
	}

	.notification-menu {
		--bs-menu-gap: 0;
		--bs-menu-padding-x: 0;
		--bs-menu-padding-y: 0;
		width: 22rem;
		overflow: hidden;
		font-size: 0.9375rem;
	}

	.notification-menu-head,
	.notification-menu-foot {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0.6rem 0.9rem;
		border-bottom: 1px solid var(--bs-border-color);
	}

	.notification-menu-foot {
		justify-content: center;
		border-top: 1px solid var(--bs-border-color);
		border-bottom: 0;
		font-size: 0.875rem;
		text-decoration: none;
	}

	.notification-menu-list {
		max-height: 22rem;
		overflow-y: auto;
	}

	.notification-menu-list .notification-item:last-child {
		border-bottom: 0;
	}

	.notification-menu-empty {
		padding: 1.5rem 1rem;
		color: var(--bs-fg-3);
		text-align: center;
	}

	.notification-item {
		display: flex;
		gap: 0.75rem;
		padding: 0.7rem 0.9rem;
		border-bottom: 1px solid var(--bs-border-color);
		color: var(--bs-fg-body);
		text-decoration: none;
	}

	.notification-item:hover {
		background: var(--bs-bg-1);
		color: var(--bs-fg-body);
	}

	.notification-item.unread {
		box-shadow: inset 3px 0 0 var(--bs-primary-bg);
	}

	.notification-item.unread .notification-item-title {
		font-weight: 700;
	}

	.notification-item-icon {
		flex: 0 0 auto;
		width: 1.5rem;
		padding-top: 0.1rem;
		color: var(--bs-fg-3);
		text-align: center;
	}

	.notification-item-text {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
		min-width: 0;
	}

	.notification-item-title,
	.notification-item-body {
		overflow-wrap: anywhere;
	}

	.notification-item-body,
	.notification-item-time {
		color: var(--bs-fg-3);
		font-size: 0.8125rem;
	}

	/* =============================================================
	   Two-step sign-in — the code field, the QR code, recovery codes.
	   ============================================================= */

	.code-input {
		max-width: 16rem;
		font-variant-numeric: tabular-nums;
		letter-spacing: 0.2em;
	}

	/* A QR code must stay dark on light, whatever the theme: scanners need the contrast. */
	.twofactor-qr {
		width: 200px;
		height: 200px;
		padding: 0.5rem;
		border-radius: var(--bs-radius-5);
		background: #fff;
	}

	.twofactor-secret {
		display: inline-block;
		padding: 0.25rem 0.5rem;
		border-radius: var(--bs-radius-4);
		background: var(--bs-bg-2);
		color: var(--bs-fg-body);
		letter-spacing: 0.08em;
		user-select: all;
	}

	.recovery-codes {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
		gap: 0.5rem;
		max-width: 32rem;
	}

	.recovery-codes code {
		padding: 0.35rem 0.6rem;
		border-radius: var(--bs-radius-4);
		background: var(--bs-bg-2);
		color: var(--bs-fg-body);
		font-size: 0.95rem;
		text-align: center;
		user-select: all;
	}

	/* =============================================================
	   Background jobs — a running job's progress in the jobs list. A
	   native <progress>: its value is an attribute, so no inline style.
	   ============================================================= */

	.job-progress {
		display: block;
		width: 100%;
		min-width: 6rem;
		max-width: 12rem;
		height: 0.4rem;
		margin-top: 0.4rem;
		overflow: hidden;
		border: 0;
		border-radius: 1rem;
		background: var(--bs-bg-3);
		appearance: none;
	}

	.job-progress::-webkit-progress-bar {
		background: var(--bs-bg-3);
	}

	.job-progress::-webkit-progress-value {
		background: var(--bs-primary-bg);
		transition: width 0.4s ease;
	}

	.job-progress::-moz-progress-bar {
		background: var(--bs-primary-bg);
	}

	/* =============================================================
	   Bulk-actions bar — form[data-bulk-form].bulk-bar. Hidden until
	   a row is ticked; floats at the bottom centre of the window.
	   ============================================================= */

	.bulk-bar {
		position: fixed;
		bottom: 1.25rem;
		left: 50%;
		z-index: var(--bs-z-fixed);
		display: flex;
		align-items: center;
		gap: 0.5rem;
		max-width: calc(100vw - 2rem);
		padding: 0.5rem 0.75rem;
		border: 1px solid var(--bs-border-color);
		border-radius: var(--bs-radius-7);
		background: var(--bs-bg-body);
		box-shadow: var(--bs-box-shadow-xl);
		opacity: 0;
		visibility: hidden;
		transform: translate(-50%, 150%);
		transition: transform 0.18s ease, opacity 0.18s ease, visibility 0.18s;
	}

	.bulk-bar.show {
		opacity: 1;
		visibility: visible;
		transform: translate(-50%, 0);
	}

	.bulk-bar-count {
		padding: 0 0.25rem;
		white-space: nowrap;
	}

	.bulk-bar-divider {
		align-self: stretch;
		width: 1px;
		background: var(--bs-border-color);
	}

	/* =============================================================
	   Live lists + instant navigation — progress feedback. Shown only
	   when a request takes longer than a moment (script.js adds the
	   class).
	   ============================================================= */

	.zo-progress {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 2000;
		width: 0;
		height: 3px;
		background: var(--bs-primary-bg);
		opacity: 0;
		pointer-events: none;
		transition: width 0.3s ease, opacity 0.3s ease;
	}

	.zo-progress.show {
		width: 70%;
		opacity: 1;
		transition: width 8s cubic-bezier(0.1, 0.6, 0.2, 1), opacity 0.1s;
	}

	.zo-progress.done {
		width: 100%;
		opacity: 0;
	}

	[data-live-region].live-loading {
		opacity: 0.55;
		transition: opacity 0.15s ease;
	}

	/* =============================================================
	   Command palette (Ctrl+K) — the CommandPalette partial, a
	   Bootstrap dialog near the top of the window.
	   ============================================================= */

	.command-palette {
		--bs-dialog-width: 38.75rem;
		margin-top: 10vh;
		overflow: hidden;
	}

	.command-palette-input {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		padding: 0.75rem 1rem;
		border-bottom: 1px solid var(--bs-border-color);
	}

	.command-palette-input .form-control,
	.command-palette-input .form-control:focus-visible {
		padding: 0.25rem 0;
		border: 0;
		outline: 0;
		background: transparent;
		box-shadow: none;
		font-size: 1.05rem;
	}

	.command-palette-results {
		max-height: 55vh;
		padding: 0.5rem;
		overflow-y: auto;
	}

	.command-palette-group {
		padding: 0.5rem 0.75rem 0.25rem;
		color: var(--bs-fg-3);
		font-size: 0.75rem;
		font-weight: 600;
		letter-spacing: 0.04em;
		text-transform: uppercase;
	}

	.command-palette-item {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		padding: 0.5rem 0.75rem;
		border-radius: var(--bs-radius-5);
		color: var(--bs-fg-body);
		text-decoration: none;
		cursor: pointer;
	}

	.command-palette-item .fas {
		width: 1.25rem;
		color: var(--bs-fg-3);
		text-align: center;
	}

	.command-palette-item.active,
	.command-palette-item:hover {
		background: var(--bs-bg-2);
		color: var(--bs-fg-body);
	}

	.command-palette-item small {
		margin-left: auto;
		color: var(--bs-fg-3);
	}

	.command-palette-empty {
		padding: 1.5rem 0.75rem;
		color: var(--bs-fg-3);
		text-align: center;
	}

	.command-palette-footer {
		display: flex;
		gap: 1rem;
		padding: 0.5rem 1rem;
		border-top: 1px solid var(--bs-border-color);
		color: var(--bs-fg-3);
		font-size: 0.75rem;
	}

	/* A remote dialog ([data-remote-modal]) while its content loads. */
	.zo-remote-modal-loading {
		padding: 3rem 1rem;
		color: var(--bs-fg-3);
		text-align: center;
	}

	@media (prefers-reduced-motion: reduce) {
		.bulk-bar,
		.kpi,
		.zo-progress,
		#zo-toast,
		[data-live-region].live-loading {
			transition: none;
		}
	}

	/* A form that is the whole content of a dialog: its header, body and
	   footer lay out as if they were the dialog's own children. */
	.dialog > form {
		display: contents;
	}

	/* =============================================================
	   The record page — one product, and later one client, one
	   invoice, one import (Product.view.html is the reference).

	     .record-head            a card: the summary that stays in view
	       .record-picture         the record's picture, or .record-picture-empty
	       .record-main            .record-tags (a .record-code, badges) + .record-meta
	       .record-stats           <dl> of .record-stat: a label and a figure
	       .record-actions         the actions on the whole record
	     .record-tabs            <ul class="nav nav-underline"> — the parts of the record
	       .record-tab-count       how many there are in a tab
	     .record-side            the narrow column of a form: cards stacked
	   ============================================================= */

	.record-head {
		margin-bottom: 1rem;
	}

	.record-head-body {
		display: flex;
		flex-flow: row wrap;
		align-items: center;
		gap: 1rem 1.5rem;
	}

	.record-picture {
		display: flex;
		flex: 0 0 auto;
		align-items: center;
		justify-content: center;
		width: 5.5rem;
		height: 5.5rem;
		overflow: hidden;
		border: 1px solid var(--bs-border-color);
		border-radius: var(--bs-radius-5);
		background: #fff;      /* product pictures are cut out for white: also in dark mode */
	}

	.record-picture img {
		width: 100%;
		height: 100%;
		object-fit: contain;
	}

	.record-picture-empty {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 100%;
		background: var(--bs-bg-1);
		color: var(--bs-fg-4);
		font-size: 1.5rem;
	}

	.record-main {
		display: flex;
		flex: 1 1 14rem;
		flex-direction: column;
		gap: 0.5rem;
		min-width: 0;
	}

	.record-tags {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 0.5rem;
	}

	/* What identifies the record on paper: its code, its number. */
	.record-code {
		display: inline-flex;
		align-items: center;
		gap: 0.5rem;
		padding: 0.125rem 0.625rem;
		border: 1px solid var(--bs-border-color);
		border-radius: var(--bs-radius-3);
		background: var(--bs-bg-1);
		font-variant-numeric: tabular-nums;
		font-weight: 600;
	}

	.record-meta {
		display: flex;
		flex-wrap: wrap;
		gap: 0.25rem 1.25rem;
		color: var(--bs-fg-3);
		font-size: 0.8125rem;
	}

	.record-stats {
		display: flex;
		flex: 0 1 auto;
		flex-wrap: wrap;
		gap: 0.5rem 2rem;
		margin: 0;
	}

	.record-stat dt {
		color: var(--bs-fg-3);
		font-size: 0.75rem;
		font-weight: 500;
	}

	.record-stat dd {
		margin: 0;
		font-family: var(--app-heading-font, inherit);
		font-size: 1.25rem;
		font-weight: 700;
		line-height: 1.3;
	}

	.record-actions {
		display: flex;
		flex: 0 0 auto;
		flex-wrap: wrap;
		gap: 0.5rem;
		margin-inline-start: auto;
	}

	.record-tabs {
		--bs-nav-gap: 1.75rem;
		margin-bottom: 1.25rem;
		border-bottom: 1px solid var(--bs-border-color);
		flex-wrap: nowrap;
		overflow-x: auto;      /* on a phone the tabs scroll sideways instead of stacking */
		scrollbar-width: none;
	}

	.record-tabs .nav-link {
		display: inline-flex;
		align-items: center;
		gap: 0.5rem;
		padding-block: 0.625rem;
		color: var(--bs-fg-2);
		white-space: nowrap;
	}

	.record-tabs .nav-link.active {
		color: var(--bs-fg-body);
		border-block-end-color: var(--bs-primary-bg);
	}

	.record-tab-count {
		min-width: 1.375rem;
		padding: 0 0.375rem;
		border-radius: 999px;
		background: var(--bs-bg-3);
		color: var(--bs-fg-2);
		font-size: 0.75rem;
		font-weight: 600;
		line-height: 1.375rem;
		text-align: center;
	}

	.record-side {
		display: flex;
		flex-direction: column;
		gap: 1rem;
	}

	@media (width < 768px) {
		.record-picture {
			width: 4.5rem;
			height: 4.5rem;
		}

		.record-stats {
			flex: 1 1 100%;
			gap: 0.5rem 1.5rem;
		}

		.record-actions {
			margin-inline-start: 0;
		}
	}

	/* =============================================================
	   The stock ledger — the Stock tab of a product (.stock-entry,
	   the form that records an entry; .stock-card, its lines) and
	   the list of all entries.
	   ============================================================= */

	.record-stat dd small {
		color: var(--bs-fg-3);
		font-size: 0.75rem;
		font-weight: 500;
	}

	/* A figure on the left of a list's head (what all the stock is worth). */
	.list-summary {
		display: flex;
		align-items: baseline;
		gap: 0.5rem;
		margin-inline-end: auto;
	}

	.list-summary strong {
		font-size: 1.125rem;
	}

	.stock-entry {
		display: flex;
		flex-direction: column;
		gap: 1rem;
	}

	/* In / out / correction: three radios drawn as one row of choices. */
	.stock-entry-kinds {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 0.5rem;
	}

	.stock-entry-kind {
		position: relative;
		margin: 0;
	}

	.stock-entry-kind input {
		position: absolute;
		inset: 0;
		opacity: 0;
	}

	.stock-entry-kind > span {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 0.25rem;
		height: 100%;
		padding: 0.5rem 0.25rem;
		border: 1px solid var(--bs-border-color);
		border-radius: var(--bs-radius-4);
		color: var(--bs-fg-2);
		font-size: 0.8125rem;
		font-weight: 600;
		text-align: center;
		cursor: pointer;
	}

	.stock-entry-kind input:checked + span {
		border-color: var(--bs-primary-border);
		background: var(--bs-primary-bg-subtle);
		color: var(--bs-primary-fg-emphasis);
	}

	.stock-entry-kind input:focus-visible + span {
		outline: 2px solid var(--bs-primary-focus-ring);
		outline-offset: 2px;
	}

	/* What the form asks for follows the kind — said in CSS, there is nothing to script:
	   a purchase price only for what comes in; "counted" wording only for a correction. */
	.stock-entry-cost,
	.stock-entry-counted {
		display: none;
	}

	.stock-entry:has([data-stock-kind="in"]:checked) .stock-entry-cost,
	.stock-entry:has([data-stock-kind="count"]:checked) .form-text.stock-entry-counted {
		display: block;
	}

	.stock-entry:has([data-stock-kind="count"]:checked) span.stock-entry-counted {
		display: inline;
	}

	.stock-entry:has([data-stock-kind="count"]:checked) .stock-entry-moved {
		display: none;
	}

	/* The lines: what came in is green, and it has a column of its own — colour is not the only sign. */
	.stock-card .stock-in {
		color: var(--bs-success-fg);
		font-weight: 600;
	}

	.stock-card .stock-out {
		font-weight: 600;
	}

	.stock-card-document {
		display: block;
		margin-top: 0.25rem;
	}

	/* "Below minimum" beside a quantity in a list. */
	.stock-low {
		margin-inline-end: 0.25rem;
		color: var(--bs-warning-fg);
	}

	/* =============================================================
	   The price catalog of a client — the "Price catalog" tab of its
	   page: .catalog-tools (a bar of .catalog-add forms that put
	   products in) above .catalog-table (its lines, each with a price
	   to type), which keeps the whole width for the products' names.
	   ============================================================= */

	.catalog-tools .card-body {
		display: flex;
		flex-direction: column;
		gap: 1rem;
	}

	/* One form: its field(s) and its button on one line from md up, the hint under them. */
	.catalog-add {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		align-items: end;
		gap: 0.5rem 0.75rem;
	}

	.catalog-add + .catalog-add {
		padding-top: 1rem;
		border-top: 1px solid var(--bs-border-color);
	}

	.catalog-add .form-label {
		margin-bottom: 0.25rem;
	}

	.catalog-add-hint {
		grid-column: 1 / -1;
		margin: 0;
	}

	@media (width >= 768px) {
		.catalog-add {
			grid-template-columns: minmax(0, 1fr) auto;
		}

		.catalog-add:has(.catalog-add-price) {
			grid-template-columns: minmax(0, 1fr) 9rem auto;
		}
	}

	.catalog-actions {
		display: flex;
		flex-wrap: wrap;
		gap: 0.5rem;
	}

	/* The price of a line: a narrow field at the right edge of its cell, figures aligned. */
	.catalog-table .catalog-price {
		width: 7.5rem;
		margin-inline-start: auto;
		text-align: end;
	}

	/* A price under the purchase price is said in words (its title) and in colour. */
	.catalog-below {
		color: var(--bs-danger-fg);
		font-weight: 600;
	}

	.catalog-foot {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		gap: 0.25rem 1rem;
		color: var(--bs-fg-3);
		font-size: 0.8125rem;
	}

	.catalog-unpriced {
		color: var(--bs-warning-fg);
	}

	@media (width < 768px) {
		/* A row is a card on a phone: the price field takes the width that is left. */
		.catalog-table .catalog-price {
			width: 100%;
			max-width: 10rem;
		}
	}

	/* =============================================================
	   Attachments — the AttachmentsPanel partial ([data-attachments]
	   in script.js): a drop area, then a grid of pictures (a gallery)
	   or a list of files.
	   ============================================================= */

	.attachments {
		display: flex;
		flex-direction: column;
		gap: 0.875rem;
		transition: opacity 0.15s ease;
	}

	.attachments.is-busy {
		opacity: 0.6;
		pointer-events: none;
	}

	.attachments-drop {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: center;
		gap: 0.5rem 0.75rem;
		padding: 1.125rem 1rem;
		border: 1.5px dashed var(--bs-border-color);
		border-radius: var(--bs-radius-7);
		background: var(--bs-bg-1);
		color: var(--bs-fg-2);
		cursor: pointer;
		transition: border-color 0.15s ease, background-color 0.15s ease;
	}

	.attachments-drop:hover,
	.attachments-drop:focus-within,
	.attachments-drop.is-over {
		border-color: var(--bs-primary-border);
		background: var(--bs-primary-bg-subtle);
	}

	.attachments-drop-icon {
		color: var(--bs-primary-fg);
		font-size: 1.25rem;
	}

	.attachments-drop-hint {
		color: var(--bs-fg-3);
		font-size: 0.8125rem;
	}

	.attachments-empty {
		margin: 0;
		color: var(--bs-fg-3);
	}

	.attachments-grid {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
		gap: 0.75rem;
	}

	.attachments-thumb {
		position: relative;
		margin: 0;
		overflow: hidden;
		border: 1px solid var(--bs-border-color);
		border-radius: var(--bs-radius-5);
		background: var(--bs-bg-1);
	}

	.attachments-thumb.is-primary {
		border-color: var(--bs-primary-border);
		box-shadow: 0 0 0 2px var(--bs-primary-bg-subtle);
	}

	.attachments-thumb img {
		display: block;
		width: 100%;
		aspect-ratio: 1;
		object-fit: contain;
		background: #fff;      /* product pictures are cut out for white: also in dark mode */
	}

	.attachments-primary {
		position: absolute;
		top: 0.375rem;
		left: 0.375rem;
	}

	.attachments-thumb .attachments-actions {
		display: flex;
		justify-content: flex-end;
		gap: 0.25rem;
		padding: 0.25rem;
		border-top: 1px solid var(--bs-border-color);
		background: var(--bs-bg-body);
	}

	.attachments-files {
		display: flex;
		flex-direction: column;
		margin: 0;
		padding: 0;
		list-style: none;
		border: 1px solid var(--bs-border-color);
		border-radius: var(--bs-radius-5);
	}

	.attachments-file {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		padding: 0.5rem 0.75rem;
	}

	.attachments-file + .attachments-file {
		border-top: 1px solid var(--bs-border-color);
	}

	.attachments-file-icon {
		flex: 0 0 auto;
		width: 1.5rem;
		color: var(--bs-fg-3);
		font-size: 1.125rem;
		text-align: center;
	}

	.attachments-file-name {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
		min-width: 0;
		overflow-wrap: anywhere;
	}

	.attachments-file-name a {
		color: var(--bs-fg-body);
		font-weight: 500;
		text-decoration: none;
	}

	.attachments-file-name a:hover {
		color: var(--bs-primary-fg);
		text-decoration: underline;
	}

	.attachments-file-meta {
		color: var(--bs-fg-3);
		font-size: 0.8125rem;
	}

	.attachments-file .attachments-actions {
		display: flex;
		flex: 0 0 auto;
		gap: 0.25rem;
	}

	/* =============================================================
	   Record picker — [data-lookup]: a text field with a menu of
	   matches under it.
	   ============================================================= */

	.lookup {
		position: relative;
	}

	.lookup-menu {
		position: absolute;
		inset-inline: 0;
		top: calc(100% + 0.25rem);
		z-index: var(--bs-z-dropdown, 1000);
		display: flex;
		flex-direction: column;
		max-height: 18rem;
		overflow-y: auto;
		padding: 0.25rem;
		border: 1px solid var(--bs-border-color);
		border-radius: var(--bs-radius-5);
		background: var(--bs-bg-body);
		box-shadow: var(--bs-box-shadow-lg);
	}

	.lookup-menu[hidden] {
		display: none;
	}

	.lookup-item {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		padding: 0.4rem 0.625rem;
		border: 0;
		border-radius: var(--bs-radius-3);
		background: none;
		color: var(--bs-fg-body);
		font: inherit;
		text-align: start;
		cursor: pointer;
	}

	.lookup-item:hover,
	.lookup-item.active {
		background: var(--bs-primary-bg-subtle);
		color: var(--bs-primary-fg-emphasis);
	}

	.lookup-item-subtitle,
	.lookup-empty {
		color: var(--bs-fg-3);
		font-size: 0.8125rem;
	}

	.lookup-empty {
		padding: 0.4rem 0.625rem;
	}

	/* =============================================================
	   Document lines — [data-lines]: the editable table of an
	   invoice, an offer, a stock document, and its totals.
	   ============================================================= */

	.lines-table {
		--bs-table-cell-padding-x: 0.375rem;
		--bs-table-cell-padding-y: 0.375rem;
		margin-bottom: 0;
	}

	.lines-table > thead {
		color: var(--bs-fg-2);
		font-size: 0.8125rem;
		white-space: nowrap;
	}

	.lines-table .lines-col-wide {
		min-width: 16rem;
	}

	.lines-table .lines-col-num {
		width: 7.5rem;
	}

	.lines-table .lines-col-narrow {
		width: 5.5rem;
	}

	.lines-table .lines-col-action {
		width: 2.5rem;
	}

	.lines-table td.num {
		padding-inline-end: 0.75rem;
		font-weight: 500;
	}

	.lines-foot {
		display: flex;
		flex-wrap: wrap;
		align-items: flex-start;
		justify-content: space-between;
		gap: 1rem;
		padding: 0.875rem 1rem;
		border-top: 1px solid var(--bs-border-color);
	}

	.lines-totals {
		display: grid;
		grid-template-columns: auto auto;
		gap: 0.25rem 1.5rem;
		margin-inline-start: auto;
		text-align: end;
	}

	.lines-totals dt {
		color: var(--bs-fg-2);
		font-weight: 400;
	}

	.lines-totals dd {
		margin: 0;
	}

	.lines-totals .lines-grand {
		padding-top: 0.375rem;
		border-top: 1px solid var(--bs-border-color);
		font-family: var(--app-heading-font);
		font-size: 1.125rem;
		font-weight: 700;
	}

	/* The interface kit (AdminKit): the VAT breakdown beside the totals, the server's answer. */
	.kit-groups {
		width: auto;
		margin: 0;
		font-size: 0.875rem;
	}

	.kit-result {
		color: var(--bs-fg-2);
	}

	/* =============================================================
	   Printing a page of the application (Ctrl+P, [data-print-page]):
	   the content only, on white. Documents have a layout of their
	   own (document.css).
	   ============================================================= */

	@media print {
		body {
			background: #fff;
		}

		.sidebar,
		.app-mobilebar,
		.app-controls,
		.app-footer,
		.list-head,
		.list-bar,
		.bulk-bar,
		.command-palette,
		.attachments-drop,
		.attachments-actions,
		#zo-toast,
		[data-lines-add],
		[data-lines-remove] {
			display: none !important;
		}

		.app-content {
			--app-pad-x: 0px;
			--app-pad-y: 0px;
			--app-pad-end: 0px;
			margin: 0;
			padding: 0;
		}

		.app-header {
			position: static;
			margin: 0 0 1rem;
			padding: 0;
			border: 0;
			background: none;
		}

		.card {
			box-shadow: none !important;
			break-inside: avoid;
		}
	}

}
