/**
 * Workbench list — the shared record list.
 *
 * A list of things that each have an identity, a muted line of facts about
 * them, and something you can do with them: orders, invoices, saved plans,
 * planting palettes. Where `wb-table` compares things across columns, this
 * one stacks each record into a two-line row, so the same list reads on a
 * phone without becoming a table of nothing.
 *
 * Taken from the account console the group already runs (Mibble's
 * operational list): a head band of saved views with counts and a quiet
 * search, 64px rows split by full-width hairlines with no outer card, mono
 * identifiers, outlined tags, and a pager.
 *
 * Enqueue the `wb-list` handle and put `wb-list` on the wrapper. Colours,
 * density and motion come from custom properties, so a site retunes it
 * without forking the rules. `--wb-list-accent` is the brand colour used
 * for focus rings and the active view.
 *
 * Structure:
 *   .wb-list
 *     .wb-list__band        views + search
 *       .wb-list__views > a.wb-list__view > .wb-list__view-count
 *       .wb-list__query > form.wb-list__search, a.wb-list__chip
 *     ol.wb-list__rows > li.wb-list__row
 *       .wb-list__identity > .wb-list__line ( .wb-list__id, .wb-list__title,
 *                              .wb-list__tag ) + .wb-list__meta
 *       .wb-list__trail > .wb-list__figure, .wb-list__action
 *     .wb-list__empty
 *     .wb-list__pager > .wb-list__count, .wb-list__steps
 */

.wb-list {
	--wb-list-border: #e6e6e6;
	--wb-list-input: #cecece;
	--wb-list-ink: #1f1f1f;
	--wb-list-ink-2: #5c5c5c;
	--wb-list-ink-3: #6b6b6b;
	--wb-list-hover: color-mix(in srgb, #1f1f1f 4%, #fff);
	--wb-list-press: color-mix(in srgb, #1f1f1f 8%, transparent);
	--wb-list-accent: var(--wp--preset--color--primary, #2f5bd8);
	--wb-list-brand: var(--wb-list-accent);
	--wb-list-brand-soft: color-mix(
		in srgb,
		var(--wb-list-accent) 10%,
		transparent
	);
	--wb-list-mono: "JetBrains Mono", "SF Mono", ui-monospace, menlo, monospace;
	--wb-list-thumb: 48px;
	--wb-list-row: 72px;
	--wb-list-cell-y: 12px;
	--wb-list-radius: 8px;
	--wb-list-motion: 110ms cubic-bezier(0.22, 0.61, 0.36, 1);
	margin-top: 20px;
	color: var(--wb-list-ink);
}

.wb-list p {
	margin: 0;
}

.wb-list__band {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 56px;
	border-bottom: 1px solid var(--wb-list-border);
}

.wb-list__views {
	display: flex;
	flex: 1;
	align-items: center;
	gap: 4px;
	min-width: 0;
	margin: -4px 0;
	padding: 4px 0;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
}

.wb-list__views::-webkit-scrollbar {
	display: none;
}

/* View tabs: a quiet outline for the active view, never the brand fill. */
.wb-list a.wb-list__view,
.wb-list button.wb-list__view {
	display: inline-flex;
	margin: 0;
	background: transparent;
	font-family: inherit;
	cursor: pointer;
	flex: none;
	align-items: center;
	gap: 8px;
	height: 32px;
	padding: 0 12px;
	border: 1px solid transparent;
	border-radius: 9px;
	color: var(--wb-list-ink-3);
	font-size: 13px;
	font-weight: 500;
	line-height: 16px;
	text-decoration: none;
	white-space: nowrap;
	transition:
		background-color var(--wb-list-motion),
		color var(--wb-list-motion);
}

.wb-list a.wb-list__view:hover,
.wb-list button.wb-list__view:hover {
	background: var(--wb-list-hover);
	color: var(--wb-list-ink);
}

.wb-list a.wb-list__view.is-active,
.wb-list button.wb-list__view.is-active {
	border-color: var(--wb-list-border);
	background: #fff;
	color: var(--wb-list-ink);
	font-weight: 600;
}

.wb-list__view-count {
	color: var(--wb-list-ink-3);
	font-family: var(--wb-list-mono);
	font-size: 11px;
	font-variant-numeric: tabular-nums;
	font-weight: 400;
}

.wb-list__view.is-active .wb-list__view-count {
	color: var(--wb-list-brand);
}

.wb-list__query {
	display: flex;
	flex: none;
	align-items: center;
	gap: 8px;
}

.wb-list a.wb-list__chip,
.wb-list button.wb-list__chip {
	display: inline-flex;
	order: -1;
	align-items: center;
	gap: 4px;
	height: 32px;
	padding: 0 4px 0 8px;
	border: 1px dashed var(--wb-list-input);
	border-radius: 8px;
	color: var(--wb-list-ink);
	font-size: 12px;
	text-decoration: none;
}

.wb-list__chip-x {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 8px;
	color: var(--wb-list-ink-3);
	font-size: 15px;
}

.wb-list__chip:hover .wb-list__chip-x {
	background: var(--wb-list-press);
	color: var(--wb-list-ink);
}

/* Search reads like the list's filter controls: text-only until used. */
.wb-list__search {
	position: relative;
	display: flex;
	align-items: center;
	margin: 0;
}

.wb-list__search svg {
	position: absolute;
	top: 50%;
	left: 10px;
	color: var(--wb-list-ink-3);
	pointer-events: none;
	transform: translateY(-50%);
}

.wb-list .wb-list__search input[type="search"] {
	width: 180px;
	height: 32px;
	margin: 0;
	padding: 0 10px 0 30px;
	border: 1px solid transparent;
	border-radius: 9px;
	background: transparent;
	box-shadow: none;
	color: var(--wb-list-ink);
	font: inherit;
	font-size: 13px;
	transition:
		background-color var(--wb-list-motion),
		border-color var(--wb-list-motion);
}

.wb-list .wb-list__search input[type="search"]::placeholder {
	color: var(--wb-list-ink-3);
	opacity: 1;
}

.wb-list .wb-list__search input[type="search"]:hover {
	background: var(--wb-list-hover);
}

.wb-list .wb-list__search input[type="search"]:focus {
	border-color: var(--wb-list-brand);
	outline: 3px solid var(--wb-list-brand-soft);
	outline-offset: 0;
	background: #fff;
}

/*
 * A menu in the head band: a filter or a sort that would crowd the saved
 * views if it sat beside them. Built on <details>, so it opens and closes
 * without a line of script, and closes on Escape like any dialog.
 */
.wb-list__menu {
	position: relative;
	flex: none;
}

.wb-list .wb-list__menu-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 32px;
	padding: 0 10px;
	border: 1px solid transparent;
	border-radius: 9px;
	color: var(--wb-list-ink-3);
	font-size: 13px;
	font-weight: 500;
	line-height: 16px;
	white-space: nowrap;
	cursor: pointer;
	list-style: none;
	transition:
		background-color var(--wb-list-motion),
		color var(--wb-list-motion);
}

.wb-list__menu-toggle::-webkit-details-marker {
	display: none;
}

.wb-list .wb-list__menu-toggle:hover,
.wb-list__menu[open] .wb-list__menu-toggle {
	background: var(--wb-list-hover);
	color: var(--wb-list-ink);
}

/* A menu with something chosen says so, the way an active view does. */
.wb-list .wb-list__menu-toggle.is-active {
	border-color: var(--wb-list-border);
	color: var(--wb-list-ink);
}

.wb-list__menu-toggle svg {
	flex: none;
	transition: transform var(--wb-list-motion);
}

.wb-list__menu[open] .wb-list__menu-toggle svg {
	transform: rotate(180deg);
}

.wb-list__menu-panel {
	position: absolute;
	z-index: 20;
	top: calc(100% + 6px);
	right: 0;
	display: flex;
	flex-direction: column;
	min-width: 190px;
	padding: 6px;
	border: 1px solid var(--wb-list-border);
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 16px 32px -12px rgb(0 0 0 / 22%);
}

.wb-list .wb-list__menu-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	box-sizing: border-box;
	gap: 12px;
	width: auto;
	height: 34px;
	padding: 0 10px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--wb-list-ink-2);
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	text-align: left;
	white-space: nowrap;
	cursor: pointer;
}

.wb-list .wb-list__menu-item:hover {
	background: var(--wb-list-hover);
	color: var(--wb-list-ink);
}

.wb-list .wb-list__menu-item.is-active {
	color: var(--wb-list-ink);
	font-weight: 600;
}

.wb-list__menu-count {
	color: var(--wb-list-ink-3);
	font-size: 12px;
	font-weight: 500;
}

.wb-list__rows {
	margin: 0;
	padding: 0;
	list-style: none;
}

/*
 * Named through the list it sits in: a page's global styles reach for
 * `li:first-child` and would otherwise take the first row's top padding
 * away, leaving one row shorter than the rest.
 */
.wb-list .wb-list__rows > .wb-list__row {
	display: flex;
	align-items: center;
	gap: 16px;
	min-height: var(--wb-list-row);
	margin: 0;
	padding: var(--wb-list-cell-y) 8px var(--wb-list-cell-y) 4px;
	border-bottom: 1px solid var(--wb-list-border);
	transition: background-color var(--wb-list-motion);
}

/*
 * A page's global styles reach for `li:first-child` with a specificity a
 * plain class cannot beat, and take the first row's top padding away —
 * leaving one row sitting higher than the rest of the list.
 */
.wb-list .wb-list__rows > .wb-list__row:first-child {
	padding-top: var(--wb-list-cell-y);
}

/*
 * A filtered-out row: `hidden` alone loses to the row's own display, so
 * the list has to say it. Without this a filter marks rows hidden and
 * nothing moves.
 */
.wb-list .wb-list__rows > .wb-list__row[hidden] {
	display: none;
}

.wb-list .wb-list__rows > .wb-list__row:hover {
	background: var(--wb-list-hover);
}

/*
 * A picture, where the record has one. The account's rows carry none; a
 * palette or a product does, and at the same size a table row gives it.
 */
.wb-list__thumb {
	display: block;
	flex: none;
	overflow: hidden;
	width: var(--wb-list-thumb, 52px);
	height: var(--wb-list-thumb, 52px);
	border-radius: var(--wb-list-radius, 10px);
	object-fit: cover;
}

/* A thumbnail is often a span around an <img>: round them together. */
.wb-list__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: inherit;
	object-fit: cover;
}

.wb-list__thumb--empty {
	background: currentcolor;
	opacity: 0.12;
}

.wb-list__identity {
	display: flex;
	flex: 1;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
	min-width: 0;
}

.wb-list .wb-list__line {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	font-size: 15px;
	line-height: 22px;
}

.wb-list a.wb-list__id {
	flex: none;
	color: var(--wb-list-ink);
	font-family: var(--wb-list-mono);
	font-size: 14px;
	font-weight: 700;
	letter-spacing: -0.01em;
	text-decoration: none;
}

.wb-list a.wb-list__id:hover {
	text-decoration: underline;
}

.wb-list__title {
	overflow: hidden;
	min-width: 0;
	color: var(--wb-list-ink);
	font-weight: 500;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* The record's name leads its row, the way an order number leads an invoice. */
.wb-list__title-link {
	color: inherit;
	text-decoration: none;
}

.wb-list__title-link:hover .wb-list__title {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.wb-list__tag {
	display: inline-flex;
	flex: none;
	align-items: center;
	height: 20px;
	padding: 0 8px;
	border: 1px solid var(--wb-list-border);
	border-radius: 999px;
	color: var(--wb-list-ink-2);
	font-size: 11px;
	font-weight: 500;
	line-height: 1;
}

.wb-list .wb-list__meta {
	overflow: hidden;
	color: var(--wb-list-ink-3);
	font-size: 13px;
	line-height: 18px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wb-list__trail {
	display: flex;
	flex: none;
	align-items: center;
	gap: 4px;
}

.wb-list__figure {
	min-width: 88px;
	margin-right: 8px;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	text-align: right;
	white-space: nowrap;
}

/*
 * An action is a link where it only goes somewhere, and a button where it
 * changes something (deleting a plan, sending one for a quote). They read
 * the same, so a row does not look like two kinds of control — the theme's
 * own button styling has to be undone for that, hence the reset.
 */
/*
 * An action is outlined rather than bare text: in a row of quiet grey it
 * is the one thing a reader is meant to find, and a border is what says
 * so before the pointer arrives.
 */
.wb-list a.wb-list__action,
.wb-list button.wb-list__action {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	height: 32px;
	padding: 0 12px;
	border: 1px solid var(--wb-list-border);
	border-radius: 8px;
	background: #fff;
	color: var(--wb-list-ink);
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color var(--wb-list-motion);
}

.wb-list a.wb-list__action:hover,
.wb-list button.wb-list__action:hover {
	border-color: var(--wb-list-ink-3);
	background: var(--wb-list-hover);
	color: var(--wb-list-ink);
}

/* Deleting is the one action a customer should not reach for by accident. */
.wb-list button.wb-list__action.is-quiet {
	color: var(--wb-list-ink-3);
}

.wb-list__form {
	margin: 0;
}

.wb-list .wb-list__empty {
	padding: 40px 16px;
	border-bottom: 1px solid var(--wb-list-border);
	color: var(--wb-list-ink-3);
	font-size: 14px;
	text-align: center;
}

/* Pager: count left; ‹ Page [n] of N › right, all on one line. */
.wb-list__pager {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 48px;
	padding: 0 0 0 4px;
}

.wb-list__count {
	overflow: hidden;
	color: var(--wb-list-ink-3);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wb-list__steps {
	display: flex;
	flex: none;
	align-items: center;
	gap: 2px;
}

.wb-list .wb-list__step {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	color: var(--wb-list-ink);
	text-decoration: none;
	transition: background-color var(--wb-list-motion);
}

.wb-list a.wb-list__step:hover {
	background: var(--wb-list-press);
}

.wb-list .wb-list__step.is-disabled {
	color: var(--wb-list-ink-3);
	opacity: 0.45;
}

.wb-list form.wb-list__goto {
	display: flex;
	flex: none;
	align-items: center;
	gap: 6px;
	margin: 0 4px;
	padding: 0;
	color: var(--wb-list-ink);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	line-height: 16px;
	white-space: nowrap;
}

.wb-list .wb-list__goto-label,
.wb-list .wb-list__goto-of {
	display: inline;
	flex: none;
	width: auto;
	margin: 0;
	padding: 0;
	color: var(--wb-list-ink);
	font-size: 12px;
	font-weight: 400;
	letter-spacing: normal;
	line-height: 16px;
	text-transform: none;
	white-space: nowrap;
}

.wb-list .wb-list__goto input[type="number"] {
	box-sizing: border-box;
	flex: none;
	width: 44px;
	min-width: 44px;
	max-width: 44px;
	height: 28px;
	margin: 0;
	padding: 0 4px;
	border: 1px solid var(--wb-list-input);
	border-radius: 6px;
	background: #fff;
	box-shadow: none;
	color: var(--wb-list-ink);
	font: inherit;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	text-align: center;
	-moz-appearance: textfield;
}

.wb-list .wb-list__goto input[type="number"]:focus {
	border-color: var(--wb-list-brand);
	outline: 3px solid var(--wb-list-brand-soft);
	outline-offset: 0;
}

.wb-list .wb-list__goto input[type="number"]::-webkit-inner-spin-button,
.wb-list .wb-list__goto input[type="number"]::-webkit-outer-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

@media (prefers-reduced-motion: reduce) {
	.wb-list {
		--wb-list-motion: 0ms linear;
	}
}

@media (max-width: 782px) {
	/* Band stacks: search first, view tabs scroll beneath. */
	.wb-list__band {
		flex-direction: column-reverse;
		align-items: stretch;
		gap: 8px;
		padding: 4px 0 10px;
	}

	.wb-list__query {
		flex-wrap: wrap;
	}

	.wb-list__search {
		flex: 1;
	}

	.wb-list .wb-list__search input[type="search"] {
		width: 100%;
		height: 44px;
		border-color: var(--wb-list-input);
		font-size: 16px;
	}

	.wb-list a.wb-list__view,
	.wb-list button.wb-list__view,
	.wb-list a.wb-list__chip {
		height: 40px;
	}

	/* Rows: identity on top, figure + 44px actions beneath. */
	.wb-list .wb-list__rows > .wb-list__row {
		flex-wrap: wrap;
		gap: 4px 12px;
		padding: 14px 0 6px;
	}

	.wb-list__identity {
		flex-basis: 100%;
	}

	/*
	 * A row with a picture keeps it beside the text rather than above it —
	 * that is what makes the row read as a card — and its second line is
	 * free to wrap rather than being cut off with an ellipsis. Rows
	 * without a picture, which is every row in the account, are untouched.
	 */
	.wb-list
		.wb-list__rows
		> .wb-list__row:has(.wb-list__thumb)
		.wb-list__identity {
		flex: 1 1 0;
		flex-basis: 0;
		min-width: 0;
	}

	.wb-list .wb-list__line {
		flex-wrap: wrap;
		row-gap: 2px;
	}

	.wb-list__title {
		flex-basis: 100%;
		order: 3;
		font-size: 14px;
	}

	.wb-list__trail {
		flex: 1;
		justify-content: flex-end;
	}

	.wb-list__figure {
		min-width: 0;
		margin-right: auto;
	}

	.wb-list__row:has(.wb-list__thumb) .wb-list__meta {
		overflow: visible;
		white-space: normal;
	}

	.wb-list__row:has(.wb-list__thumb) .wb-list__trail {
		flex-basis: 100%;
	}

	.wb-list a.wb-list__action {
		height: 44px;
		padding: 0 12px;
		font-size: 14px;
	}

	.wb-list .wb-list__step {
		width: 44px;
		height: 44px;
	}

	.wb-list .wb-list__goto input[type="number"] {
		height: 40px;
		font-size: 16px;
	}
}
