/* A row's actions (0.45.9): text links under the title, always shown (the owner's ruling of 19 Oct 2026: no hover
   reveal, a keyboard or touch user sees them too), a button for an action a script runs drawn as the links. */
.rooster-admin-table__actions {
	@apply mt-0.5 flex flex-wrap gap-x-2.5 text-xs;
}

.rooster-admin-table__actions a,
.rooster-admin-table__action {
	@apply no-underline;
	color: var(--ra-accent);

	@variant hover {
		@apply underline;
	}
}

button.rooster-admin-table__action {
	@apply m-0 cursor-pointer border-0 bg-transparent p-0;
	font: inherit;
}

.rooster-admin-table__actions a.is-destructive,
.rooster-admin-table__action.is-destructive {
	@apply text-destructive-foreground;
}

/* A row's menu (0.79.0, Ui::row_menu()): its wrapper on the button's line, in a cell or a card's head; the first paint
   needs this one rule only (the list is hidden until opened): the rest is row-menu.css's, loaded with its script. */
.rooster-admin-rowmenu {
	@apply relative inline-flex align-middle;
}

.rooster-admin-table__empty {
	@apply px-4 py-8 text-center text-sm text-secondary-foreground;
}

/* The state held in view on a wide table (0.68.24): drawn at the region's visible width (table.js's --ra-view, less the
   cell's indent), held at its start while the columns scroll, so it is centred on what is on screen. Without the
   script the width is unset and the state spans the table as before. */
.rooster-admin-table__empty-in {
	@apply sticky start-4;
	width: calc(var(--ra-view) - 2rem);
}

.rooster-admin-table__footer {
	@apply flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-border px-4.5 py-2.5 text-sm;
}

/* The rows a page (0.65.3, `sizes`): its label and select at the footer's start, the pager the glue draws at its end. */
.rooster-admin-table__size {
	@apply me-auto inline-flex items-center gap-2 text-secondary-foreground;
}

/* Its label's own weight (0.65.7, Rooster One's request 38: a product's label rule made it bold on its screens). */
.rooster-admin-table .rooster-admin-table__size > label {
	@apply font-normal;
}

/* The footer's first piece (the summary, "Showing 1–20 of 48"; by name, 0.54.2: rooster-admin-table__summary) takes
   the room; the pager and the page size follow. */
.rooster-admin-table__footer > :first-child,
.rooster-admin-table__summary {
	@apply m-0 me-auto text-secondary-foreground;
}

/* The page size: its label beside a compact native select (0.45.1). */
.rooster-admin-perpage {
	@apply inline-flex items-center gap-2 text-sm text-secondary-foreground;
}

.rooster-admin .rooster-admin-perpage .rooster-admin-select {
	@apply w-auto min-w-20;
}

/* A card whose body is a table: no padding, the table's edges on the card's. */
.rooster-admin-card.is-flush .rooster-admin-card__body {
	@apply p-0;
}

.rooster-admin-card.is-flush .rooster-admin-card__desc {
	@apply px-4.5 pt-3.5;
}

/* What a flush card's body holds besides its table (a notice, a guidance text, a job, a row of figures) keeps the
   card's inset: the body's padding at its sides, off the head when it comes first, off the card's end when it comes
   last; the table alone runs edge to edge (0.68.21, the owner: a notice set against a flush card's head, "we need a
   pattern to ensure the gap for messages like this"). What is never seen neither takes the inset nor counts. */
.rooster-admin-card.is-flush
	> .rooster-admin-card__body
	> :where(
		:not(
			.rooster-admin-table,
			.rooster-admin-result,
			.rooster-admin-card__desc,
			table,
			.tablenav,
			input[type="hidden"],
			script,
			template,
			style,
			[hidden]
		)
	) {
	@apply mx-4.5;
}

.rooster-admin-card.is-flush
	> .rooster-admin-card__body
	> :where(
		:not(
			.rooster-admin-table,
			.rooster-admin-result,
			.rooster-admin-card__desc,
			table,
			.tablenav,
			input[type="hidden"],
			script,
			template,
			style,
			[hidden]
		)
	):not(:where(:not(input[type="hidden"], script, template, style, [hidden])) ~ *) {
	@apply mt-3.5;
}

.rooster-admin-card.is-flush
	> .rooster-admin-card__body
	> :where(
		:not(
			.rooster-admin-table,
			.rooster-admin-result,
			.rooster-admin-card__desc,
			table,
			.tablenav,
			input[type="hidden"],
			script,
			template,
			style,
			[hidden]
		)
	):not(:has(~ :where(:not(input[type="hidden"], script, template, style, [hidden])))) {
	@apply mb-4.5;
}

/* The card's tools at the head's end (a button, a switch), and its footer. */
.rooster-admin-card__tools {
	@apply ms-auto flex flex-wrap items-center gap-2;
}

.rooster-admin-card__footer {
	@apply ra-card-foot;
}

/* A sentence about the whole card in its footer (0.47.0), at the footer's end (0.58.0, FR14: the actions start the
   line, the note ends it); another plugin's output hosted in a body: its leading heading reads as a sub-heading. */
.rooster-admin-card__note {
	@apply m-0 text-xs leading-normal text-secondary-foreground;
}

.rooster-admin-card__footer > .rooster-admin-card__note {
	@apply ms-auto;
}

.rooster-admin-card__body.is-hosted > :is(h2, h3):first-child {
	@apply m-0 text-base font-semibold;
}

/* Key/value rows inside a card (the LMS's and Rooster One's "figures" tables). */
.rooster-admin-kv {
	@apply m-0 grid grid-cols-[minmax(10rem,auto)_minmax(0,1fr)] gap-x-6 text-sm;
}

.rooster-admin-kv > dt {
	@apply border-b border-border py-2 text-secondary-foreground;
}

.rooster-admin-kv > dd {
	@apply m-0 min-w-0 border-b border-border py-2 text-foreground;
	overflow-wrap: anywhere; /* a long value wraps where it must (0.65.1) */
}

.rooster-admin-kv > dt:nth-last-of-type(1),
.rooster-admin-kv > dd:last-child {
	@apply border-b-0;
}

/* Facts (0.65.1, Ui::facts(): one record as label / value pairs; Rooster One's request 24): a long value wraps where it
   must; the last row has no rule under it; two pairs a row where the card is wide, one under 40 rem; a code is
   selected whole by one click (to copy, with no script); an empty value is a dash. */
.rooster-admin-kv > .is-last {
	@apply border-b-0;
}

.rooster-admin-kv.is-cols-2 {
	@apply grid-cols-[minmax(8rem,auto)_minmax(0,1fr)_minmax(8rem,auto)_minmax(0,1fr)];
}

@container (width < 40rem) {
	.rooster-admin-kv.is-cols-2 {
		@apply grid-cols-[minmax(10rem,auto)_minmax(0,1fr)];
	}

	.rooster-admin-kv.is-cols-2 > .is-last {
		@apply border-b;
	}

	.rooster-admin-kv.is-cols-2 > :nth-last-child(-n + 2) {
		@apply border-b-0;
	}
}

.rooster-admin-kv__code {
	@apply rounded-sm bg-muted px-1 py-px font-mono text-xs select-all;
}

.rooster-admin-kv__none {
	@apply text-muted-foreground;
}

/* A progress as a value (0.61.0): its label, bar and figure wrap in a narrow card instead of pushing the page
   sideways (the kit at 390 px). */
.rooster-admin-kv > dd > .rooster-admin-progress {
	@apply flex-wrap;
}
