/*
 * uich-ui — the small layout / text utility set the Custom Fields builder and Module Studio
 * editor share. Everything reads --uc-* tokens directly, so there is no second token namespace to
 * keep in sync with the design system.
 */

/* ── Layout ────────────────────────────────────────────────────────────────── */
.uich-ui-flex { display: flex; }
.uich-ui-inline-flex { display: inline-flex; }
.uich-ui-grid { display: grid; grid-template-columns: repeat(var(--uich-ui-cols, 1), minmax(0, 1fr)); }
.uich-ui-flex-col { flex-direction: column; }
.uich-ui-flex-1 { flex: 1 1 0%; }
.uich-ui-min-w-0 { min-width: 0; }
.uich-ui-w-full { width: 100%; }
.uich-ui-h-auto { height: auto; }
.uich-ui-relative { position: relative; }
.uich-ui-items-center { align-items: center; }
.uich-ui-justify-between { justify-content: space-between; }
.uich-ui-justify-end { justify-content: flex-end; }
.uich-ui-m-auto { margin: auto; }
.uich-ui-text-center { text-align: center; }

/* Container grids: --uich-ui-cols[-md|-sm] come from the cols prop (see kit.jsx). */
@media (min-width: 641px) and (max-width: 1024px) {
	.uich-ui-grid { grid-template-columns: repeat(var(--uich-ui-cols-md, var(--uich-ui-cols, 1)), minmax(0, 1fr)); }
}
@media (max-width: 640px) {
	.uich-ui-grid { grid-template-columns: repeat(var(--uich-ui-cols-sm, 1), minmax(0, 1fr)); }
}

/* ── Spacing ───────────────────────────────────────────────────────────────── */
.uich-ui-gap-8 { gap: var(--uc-space-8); }
.uich-ui-gap-20 { gap: var(--uc-space-20); }
.uich-ui-p-0 { padding: 0; }
.uich-ui-p-12 { padding: var(--uc-space-12); }
.uich-ui-p-16 { padding: var(--uc-space-16); }
.uich-ui-p-32 { padding: var(--uc-space-32); }
.uich-ui-pb-12 { padding-bottom: var(--uc-space-12); }
.uich-ui-px-4 { padding-inline: var(--uc-space-4); }
.uich-ui-px-8 { padding-inline: var(--uc-space-8); }
.uich-ui-px-10 { padding-inline: var(--uc-space-10); }
.uich-ui-px-12 { padding-inline: var(--uc-space-12); }
.uich-ui-px-16 { padding-inline: var(--uc-space-16); }
.uich-ui-px-20 { padding-inline: var(--uc-space-20); }
.uich-ui-px-24 { padding-inline: var(--uc-space-24); }

/* ── Surface ───────────────────────────────────────────────────────────────── */
.uich-ui-bg-default { background: var(--uc-surface-raised); }
.uich-ui-border { border: 1px solid var(--uc-border); }
.uich-ui-rounded-sm { border-radius: var(--uc-radius-6); }
.uich-ui-rounded-md { border-radius: var(--uc-radius-12); }

/* ── Text ──────────────────────────────────────────────────────────────────── */
.uich-ui-heading { margin: 0; font-size: var(--uc-text-lg); font-weight: var(--uc-weight-semibold); line-height: var(--uc-leading-snug); color: var(--uc-text-strong); }
.uich-ui-subheading { margin: 0; font-size: var(--uc-text-sm); font-weight: var(--uc-weight-semibold); line-height: var(--uc-leading-snug); color: var(--uc-text-strong); }
.uich-ui-title-label { margin: 0; font-size: var(--uc-text-sm); font-weight: var(--uc-weight-medium); line-height: var(--uc-leading-snug); color: var(--uc-text-strong); }
.uich-ui-body { margin: 0; font-size: var(--uc-text-xs); font-weight: var(--uc-weight-regular); line-height: var(--uc-leading-normal); color: var(--uc-text-muted); }
.uich-ui-hint { margin: 0; font-size: var(--uc-text-11); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); }
.uich-ui-text-muted { color: var(--uc-text-muted); }
.uich-ui-text-error { color: var(--uc-danger); }

/* ── Toggle row group (a titled card per setting) ──────────────────────────── */
.uich-ui-tg { display: grid; gap: var(--uc-space-10); }
.uich-ui-tg--cols-1 { grid-template-columns: 1fr; }
.uich-ui-tg__item { display: flex; align-items: center; justify-content: space-between; gap: var(--uc-space-10); min-width: 0; padding: var(--uc-space-12); background: var(--uc-surface-raised); border: 1px solid var(--uc-border); border-radius: var(--uc-radius-6); }
.uich-ui-tg__item-label-row { display: flex; align-items: center; gap: var(--uc-space-4); min-width: 0; }
.uich-ui-tg__item-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }




/*
 * The screen wrapper, deliberately neutral.
 *
 * This rule used to bleed the app out to the edges of a WP admin page: a #F0F0F1 fill, a
 * -20px left margin with a matching +20px width to cancel #wpbody-content's padding, and a
 * 100vh-minus-admin-bar min-height. Inside the UiChemy dashboard there is no such padding and no
 * admin-bar offset, so the negative margin pulled the content left of its column, the extra width
 * pushed it past the right edge, and the fill painted a grey band over the dashboard's own surface.
 *
 * The host provides the surface, the padding and the height. This only needs to be a positioning
 * context for the absolutely-positioned bits inside.
 */
.uich-fields-screen {
    position: relative;
    width: 100%;
}

/* MB-53 (a11y): guarantee a visible keyboard-focus indicator across the module. :focus-visible
   only shows on keyboard focus (not mouse click), so it adds no visual noise for pointer users but
   makes tab-through legible on controls whose own component doesn't paint a focus ring. Contrast
   colour (2px solid) sits well above the 3:1 non-text contrast minimum. */
/* Design-system controls (Button, Input, Textarea, Select, Switch, Checkbox, Tabs) draw their own
   focus ring; outlining them again here stacked a second, thicker ring around every field. Only
   elements the DS does not own get one: plain links and bespoke focusable rows / handles. */
.uich-fields-screen a:not([class]):focus-visible,
.uich-fields-screen [tabindex]:not(button):not(input):not(textarea):not([role="tab"]):not([role="switch"]):not([role="checkbox"]):focus-visible {
	outline: 2px solid var(--uc-ring);
	outline-offset: 2px;
	border-radius: var(--uc-radius-6);
}

.uich-ct-cell--removing {
	display: block;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

/**
 * Menu Icon picker (Post Types → Visibility). Scoped to the picker so it can't leak into any other
 * field; the swatch grid is the only part that needs layout the shared primitives don't cover.
 */
.uich-ct-icon-preview {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	flex: 0 0 32px;
	border: 1px solid var(--uc-border);
	border-radius: 4px;
}

.uich-ct-icon-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
	gap: 4px;
	max-height: 240px;
	overflow-y: auto;
}

.uich-ct-icon-swatch {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	background: none;
	border: 1px solid transparent;
	border-radius: 4px;
	cursor: pointer;
	color: inherit;
}

.uich-ct-icon-swatch:hover {
	background: var(--uc-surface-base);
}

.uich-ct-icon-swatch:focus-visible {
	outline: 2px solid var(--uc-ring);
	outline-offset: 1px;
}

.uich-ct-icon-swatch.is-selected {
	border-color: var(--uc-text-strong);
	background: var(--uc-surface-base);
}

/*
 * Conditional-logic and location rule rows ("Show this field if …" / "Show this field group if …").
 *
 * Each control is a flex item with `uich-ui-flex-1 uich-ui-min-w-0`, so the row is allowed to shrink — but
 * .cf-kit-select carries a hard `min-width: 140px`. Once the row got narrower than the sum
 * of those minimums the triggers stopped shrinking with their wrappers and spilled out: the field
 * select's chevron was clipped by the operator select, and the value input plus the And/✕ buttons
 * were pushed outside the panel entirely. The row never wrapped either, because a flex item with
 * `flex: 1` and `min-width: 0` shrinks toward zero instead of moving to the next line.
 *
 * Fix both halves: let the trigger shrink with its wrapper, and give every control a real
 * flex-basis so the row wraps to a second line instead of crushing itself.
 */
.uich-ct-rule-row > .cf-kit-select,
.uich-ct-rule-row > input,
.uich-ct-rule-row > .uich-ui-flex {
    flex: 1 1 160px;
    min-width: 0;
}
.uich-ct-rule-row .cf-kit-select {
    min-width: 0;
}
/* Buttons keep their natural size; they are the last things that should be squeezed. */
.uich-ct-rule-row > button {
    flex: 0 0 auto;
}

/*
 * Required marker in the fields list, so the Required toggle (Validation tab) is visible without
 * opening each field. Matches the asterisk the rendered form now shows.
 */
.uich-ct-required {
    color: var(--uc-danger);
    margin-right: 2px;
    font-weight: 400;
}

/*
 * Migration wizard — indeterminate progress, used only before the first job payload arrives.
 *
 * The start request scans the source and writes every definition before it returns, so there is
 * no object count to show yet. A 0% determinate bar would read as stuck; this reads as working.
 */
.uich-mig-indeterminate__bar {
	width: 40%;
	animation: uich-mig-slide 1.1s ease-in-out infinite;
}
@keyframes uich-mig-slide {
	0%   { transform: translateX(100%); }
	100% { transform: translateX(-250%); }
}
@media ( prefers-reduced-motion: reduce ) {
	/* No sliding for anyone who asked for less motion — a static partial bar plus the spinner and
	   the "Preparing…" label still say the same thing. */
	.uich-mig-indeterminate__bar {
		animation: none;
		width: 100%;
		opacity: .35;
	}
}

/* ── Add Field: the type picker ───────────────────────────────────────────────
   A grid of cards rather than a dropdown. 25 types in a select is a list you
   scroll past; a grid is one you read. */

.uich-ct-type-card {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 12px 14px;
	text-align: right;
	cursor: pointer;
	background: var(--uc-surface-raised);
	border: 1px solid var(--uc-border);
	border-radius: var(--uc-radius-12);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.uich-ct-type-card:hover,
.uich-ct-type-card:focus-visible {
	border-color: var(--uc-brand);
	box-shadow: 0 0 0 1px var(--uc-brand);
	outline: none;
}

.uich-ct-type-card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 26px;
	width: 26px;
	height: 26px;
	border: 1px solid var(--uc-border);
	border-radius: var(--uc-radius-6);
	background: color-mix(in srgb, var(--uc-brand) 7%, var(--uc-surface-raised));
	color: var(--uc-brand);
	font-size: var(--uc-text-xs);
	font-weight: var(--uc-weight-medium);
}

.uich-ct-type-card__label {
	font-size: var(--uc-text-sm);
	color: var(--uc-text);
}

/* A locked type stays readable and clickable — the click opens the upsell, not the field. Dimming
   it to the point of looking disabled would stop people from clicking the one thing we want clicked. */
.uich-ct-type-card.is-locked .uich-ct-type-card__icon {
	background: var(--uc-surface-base);
	color: var(--uc-text-muted);
}

/* ── The field settings modal ─────────────────────────────────────────────── */

.uich-ct-field-settings__title {
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

.uich-ct-field-settings__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border: 1px solid var(--uc-border);
	border-radius: var(--uc-radius-6);
	background: color-mix(in srgb, var(--uc-brand) 7%, var(--uc-surface-raised));
	color: var(--uc-brand);
	font-size: var(--uc-text-xs);
	font-weight: var(--uc-weight-medium);
}

/* ── Modal bodies scroll, the modal itself does not ──────────────────────────
   Without a cap the settings modal grows past the viewport and the footer —
   where Done lives — goes off screen with no way back to it. */

.uich-ct-type-picker .cf-dlg__body,
.uich-ct-field-settings .cf-dlg__body {
	overflow-y: auto;
	overscroll-behavior: contain;
}

/* The type grid. 43vh keeps the search box and the first group visible together,
   so searching does not scroll the box you are typing in out of view. */
.uich-ct-type-picker .uich-ct-type-list {
	max-height: 43vh;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding-left: 4px;
}

.uich-ct-field-settings .cf-dlg__body {
	max-height: 70vh;
}

/* ── Choices: label / value rows ─────────────────────────────────────────── */

.uich-ct-choices__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 6px;
}

.uich-ct-choices__rows {
	border: 1px solid var(--uc-border);
	border-radius: var(--uc-radius-12);
	overflow: hidden;
}

.uich-ct-choice-row {
	display: grid;
	grid-template-columns: 28px 1fr 1fr 36px;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	background: var(--uc-surface-raised);
	border-bottom: 1px solid var(--uc-border);
}

.uich-ct-choice-row:last-of-type {
	border-bottom: 0;
}

.uich-ct-choice-row__drag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: grab;
	color: var(--uc-text-muted);
}

.uich-ct-choice-row__drag:active {
	cursor: grabbing;
}

.uich-ct-choices__add {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	padding: 10px;
	cursor: pointer;
	background: var(--uc-surface-raised);
	border: 0;
	border-top: 1px solid var(--uc-border);
	color: var(--uc-brand);
	font-size: var(--uc-text-sm);
	font-weight: var(--uc-weight-medium);
}

.uich-ct-choices__add:hover {
	background: color-mix(in srgb, var(--uc-brand) 7%, var(--uc-surface-raised));
}

/* Tabs sit centred over a full-width form, so they read as a heading for the panel
   below rather than as the first item in a left-aligned column. */
.uich-ct-field-settings__tabs {
	display: flex;
	justify-content: center;
	width: 100%;
}

/* With no rows above it the add button's top border sits on the container's own border and
   reads as a double line. Nothing to separate it from, so nothing to draw. */
.uich-ct-choices__add--alone {
	border-top: 0;
}


/* The locked-feature row. Same markup as the metabox lock (uich-gf-style.css), restated here
   because that stylesheet is a WP-admin asset and the dashboard screen does not load it. */
.uich-gf-pro-lock {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	border: 1px dashed var(--uc-border);
	border-radius: var(--uc-radius-12);
	background: var(--uc-surface-base);
}

.uich-gf-pro-lock-icon {
	flex: 0 0 auto;
	color: var(--uc-text-muted);
}

.uich-gf-pro-lock-text {
	flex: 1 1 auto;
	min-width: 0;
}

.uich-gf-pro-lock-text .description {
	margin: 4px 0 0;
	color: var(--uc-text-muted);
	font-size: var(--uc-text-sm);
}

/* Same baseline problem as the metabox: the CTA is an inline-block, so it rides the text baseline
   of the block beside it rather than the middle of the row once that block has two lines. */
.uich-gf-pro-lock-cta {
	flex: 0 0 auto;
	align-self: center;
	margin: 0;
}

/* WCAG AA (>= 4.5:1). The DS muted grey #737373 is 4.31:1 on #F4F4F4 and the amber badge text #AA712B
   is 3.60:1 on #FFEDD8, so this screen darkens both: #666 is 5.74 on white / 5.22 on #F4F4F4 / 4.82 on
   #EBEBEB, and #8A5A1E is 5.15 on #FFEDD8. Dark themes keep the DS values, which already pass. */
.cf-app,
.cf-dlg {
	--uc-text-muted: #666666;
	--uc-warning-fg: #8A5A1E;
}
[data-theme="dark"] .cf-app {
	--uc-text-muted: #A3A3A3;
	--uc-warning-fg: #FFC680;
}

/*
 * Custom Fields — list screen (page head, kind tabs, table, empty state, dialogs).
 *
 * Same visual language as the rest of the dashboard: DS tokens
 * only, a grey tray holding white cards for the empty state, and one bordered table with a tinted
 * header row for the list. Class prefix `cf-`.
 */

/* ── Page head ────────────────────────────────────────────────────────────── */
.cf-head-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--uc-space-6); }
/* Compact head on this screen only (ScreenHead is shared; app.scss scopes it by id). */
#uich-new-dash .cf-list .dash__head h1 { font-size: 18px; line-height: 26px; }
#uich-new-dash .cf-list .dash__head p { margin-top: var(--uc-space-4); font-size: var(--uc-text-xs); }
.cf-list > .dash__head + * { margin-top: var(--uc-space-20); }
.cf-list { display: flex; flex-direction: column; min-width: 0; }

.cf-import-summary { margin-bottom: var(--uc-space-16); }
.cf-import-summary__row { display: flex; align-items: center; justify-content: space-between; gap: var(--uc-space-12); flex-wrap: wrap; }
.cf-import-summary__list { margin: var(--uc-space-8) 0 0; padding-inline-start: 18px; font-size: var(--uc-text-xs); }
.cf-import-summary__list li { margin: 0 0 var(--uc-space-2); }

/* Keyboard focus: DS controls draw their own ring; only the starter tiles (Card role=button) need one. */
.uich-fields-screen .cf-starter:focus-visible { outline: 2px solid var(--uc-ring); outline-offset: 2px; }

/* ── Tray (grey well holding white cards) ─────────────────────────────────── */
.cf-tray { display: flex; flex-direction: column; gap: var(--uc-space-6); padding: var(--uc-space-8); border-radius: var(--uc-radius-16); background: var(--uc-surface-base); }
.cf-tray-label { padding: var(--uc-space-8) var(--uc-space-4) var(--uc-space-2); font-size: var(--uc-text-11); font-weight: var(--uc-weight-medium); color: var(--uc-text-muted); }

/* ── Empty state: hero card + three typed starters ────────────────────────── */
.cf-empty-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--uc-space-6); padding: var(--uc-space-40) var(--uc-space-24) var(--uc-space-32); }

.cf-starters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--uc-space-6); }
.cf-starter { position: relative; display: flex; align-items: flex-start; gap: var(--uc-space-10); padding: var(--uc-space-12) var(--uc-space-14); outline: none; cursor: pointer; transition: box-shadow var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-starter:hover { box-shadow: inset 0 0 0 1px var(--uc-border-strong); }
.cf-starter-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--uc-radius-8); border: 1px solid var(--uc-border-subtle); background: var(--uc-surface-base); color: var(--uc-text-strong); }
.cf-starter-body { display: flex; flex-direction: column; gap: var(--uc-space-4); min-width: 0; padding-left: var(--uc-space-16); }
.cf-starter-title { font-size: var(--uc-text-sm); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-starter-text { font-size: var(--uc-text-xs); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); }
.cf-starter-go { position: absolute; top: var(--uc-space-12); left: var(--uc-space-12); color: var(--uc-text-subtle); transition: transform var(--uc-dur-fast) var(--uc-ease-standard), color var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-starter:hover .cf-starter-go { color: var(--uc-text-strong); transform: translateX(-2px); }
@media (max-width: 900px) { .cf-starters { grid-template-columns: 1fr; } }

/* ── Browse: toolbar ──────────────────────────────────────────────────────── */
.cf-browse { display: flex; flex-direction: column; gap: var(--uc-space-12); min-width: 0; }
.cf-toolbar { display: flex; flex-direction: column; gap: var(--uc-space-12); min-width: 0; }
.cf-kind-tabs { min-width: 0; max-width: 100%; }
.cf-kind-tabs [role="tablist"] { width: 100%; }
.cf-kind-tabs [role="tab"] { white-space: nowrap; }
.cf-tab-count { display: inline-grid; place-items: center; min-width: 18px; height: 16px; padding: 0 var(--uc-space-4); border-radius: var(--uc-radius-pill); background: var(--uc-surface-sunken); font-size: var(--uc-text-2xs); font-weight: var(--uc-weight-medium); font-variant-numeric: tabular-nums; color: var(--uc-text-muted); }
[data-state="active"] > .cf-tab-count { background: var(--uc-text-strong); color: var(--uc-surface-base); }
.cf-filters { display: flex; align-items: center; gap: var(--uc-space-8); min-width: 0; }
.cf-search { flex: 1 1 auto; min-width: 0; }
.cf-search > span { width: 100%; }
.cf-search button { pointer-events: auto; margin-left: calc(var(--uc-space-6) * -1); }
.cf-trash-btn { flex: none; gap: var(--uc-space-6); }

.cf-trashbar { display: flex; align-items: center; justify-content: space-between; gap: var(--uc-space-12); flex-wrap: wrap; padding: var(--uc-space-6) var(--uc-space-14) var(--uc-space-6) var(--uc-space-6); border-radius: var(--uc-radius-12); background: var(--uc-surface-base); font-size: var(--uc-text-xs); color: var(--uc-text-muted); }

/* ── Browse: one table, rows share a grid ─────────────────────────────────── */
.cf-table { border: 1px solid var(--uc-border); border-radius: var(--uc-radius-12); background: var(--uc-surface-raised); overflow: hidden; }
.cf-tr {
	display: grid;
	grid-template-columns: 16px minmax(0, 1fr) minmax(120px, 220px) 96px 36px 28px;
	align-items: center;
	-moz-column-gap: var(--uc-space-16);
	     column-gap: var(--uc-space-16);
	min-height: 56px;
	padding: var(--uc-space-8) var(--uc-space-16);
	border-top: 1px solid var(--uc-border-subtle);
	cursor: pointer;
	transition: background var(--uc-dur-fast) var(--uc-ease-standard), opacity var(--uc-dur-base) var(--uc-ease-standard);
}
.cf-tr--trash { grid-template-columns: 16px minmax(0, 1fr) minmax(120px, 200px) 96px 236px; cursor: default; }
.cf-tbody > .cf-tr:first-child { border-top: 0; }
.cf-tbody > .cf-tr:hover { background: var(--uc-surface-base); }
.cf-tbody > .cf-tr--trash:hover { background: transparent; }
/* Selected rows: the brand tint (7% brand over the surface). */
.cf-tbody > .cf-tr.is-selected { background: color-mix(in srgb, var(--uc-brand) 7%, var(--uc-surface-raised)); }
.cf-tbody > .cf-tr.is-selected:hover { background: color-mix(in srgb, var(--uc-brand) 11%, var(--uc-surface-raised)); }
.cf-tbody > .cf-tr.is-selected + .cf-tr.is-selected { border-top-color: color-mix(in srgb, var(--uc-brand) 16%, var(--uc-surface-raised)); }
.cf-tr.is-busy { opacity: 0.55; cursor: progress; }
.cf-tr.is-removing { opacity: 0; } /* keep in sync with ROW_EXIT_MS in List.jsx */
.cf-tr--skel { cursor: default; }

.cf-th { min-height: 40px; padding-block: 0; border-top: 0; border-bottom: 1px solid var(--uc-border-subtle); background: var(--uc-surface-base); cursor: default; }
.cf-th.is-picking { padding-block: var(--uc-space-4); }
.cf-th-count { font-size: var(--uc-text-11); font-weight: var(--uc-weight-medium); color: var(--uc-text-muted); }
.cf-th-col { font-size: var(--uc-text-11); font-weight: var(--uc-weight-medium); color: var(--uc-text-subtle); white-space: nowrap; }

/* Bulk bar: replaces the header labels while rows are selected. */
.cf-bulk { grid-column: 2 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: var(--uc-space-6); min-width: 0; }
.cf-bulk-count { margin-left: var(--uc-space-6); font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-bulk .cf-bulk-btn { --_h: 24px; --_px: var(--uc-space-8); --_fs: var(--uc-text-xs); gap: var(--uc-space-4); }
.cf-bulk-busy { display: inline-flex; align-items: center; gap: var(--uc-space-6); font-size: var(--uc-text-xs); color: var(--uc-text-muted); }
.cf-bulk-clear { margin-right: auto; }
.cf-spin { animation: cf-spin 0.8s linear infinite; }
@keyframes cf-spin { to { transform: rotate(-360deg); } }

.cf-check { display: inline-flex; }
.cf-name { display: flex; align-items: center; gap: var(--uc-space-10); min-width: 0; }
.cf-row-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--uc-radius-8); border: 1px solid var(--uc-border-subtle); background: var(--uc-surface-base); color: var(--uc-text-strong); overflow: hidden; }
.cf-row-ico .dashicons { width: 18px; height: 18px; font-size: 18px; line-height: 18px; }
.cf-row-ico img { width: 18px; height: 18px; -o-object-fit: contain; object-fit: contain; }
.cf-name-text { display: flex; flex-direction: column; gap: var(--uc-space-2); min-width: 0; }
.cf-name-link, .cf-name-title { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; justify-content: flex-start; }
.cf-name-title { font-size: var(--uc-text-sm); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-name-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--uc-text-11); color: var(--uc-text-muted); }
.cf-mono { font-family: var(--uc-font-mono); color: var(--uc-text-subtle); }
.cf-tr.is-off .cf-name-link, .cf-tr.is-off .cf-row-ico { color: var(--uc-text-subtle); }

.cf-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--uc-space-4); min-width: 0; }
.cf-chips__more { background: transparent; color: var(--uc-text-subtle); padding-inline: var(--uc-space-2); cursor: default; }
.cf-none { font-size: var(--uc-text-11); color: var(--uc-text-subtle); }
.cf-when { white-space: nowrap; font-size: var(--uc-text-11); color: var(--uc-text-muted); }
.cf-active, .cf-rowmenu { display: inline-flex; }
.cf-trash-actions { display: inline-flex; align-items: center; gap: var(--uc-space-4); justify-self: end; }

.cf-noresults { border-radius: var(--uc-radius-12); background: var(--uc-surface-raised); border: 1px solid var(--uc-border); }
.cf-pagination { align-self: stretch; }

/* Skeletons */
.cf-skel { border-radius: var(--uc-radius-6); }
.cf-skel--tabs { width: 320px; max-width: 100%; height: 30px; }
.cf-skel--search { width: 100%; height: var(--uc-control-h-md); }
.cf-skel--box { width: 16px; height: 16px; }
.cf-skel--count { width: 90px; height: 12px; }
.cf-skel--ico { width: 32px; height: 32px; border-radius: var(--uc-radius-8); }
.cf-skel-lines { display: flex; flex-direction: column; gap: var(--uc-space-6); }
.cf-skel--title { width: 160px; height: 13px; }
.cf-skel--sub { width: 80px; height: 10px; }
.cf-skel--chip { width: 90px; height: 20px; }
.cf-skel--switch { width: 30px; height: 18px; border-radius: var(--uc-radius-pill); }

/* Narrower: drop Updated, then the chips; name + switch + menu always stay. */
@media (max-width: 1100px) {
	.cf-tr { grid-template-columns: 16px minmax(0, 1fr) minmax(100px, 180px) 36px 28px; }
	.cf-tr--trash { grid-template-columns: 16px minmax(0, 1fr) minmax(100px, 180px) 236px; }
	.cf-tr > .cf-when, .cf-th > .cf-th-when { display: none; }
}
@media (max-width: 720px) {
	.cf-tr { grid-template-columns: 16px minmax(0, 1fr) 36px 28px; }
	.cf-tr--trash { grid-template-columns: 16px minmax(0, 1fr) 236px; }
	.cf-tr > .cf-chips, .cf-tr > .cf-none, .cf-th > .cf-th-chips { display: none; }
	.cf-filters { flex-wrap: wrap; }
}

/* ── Dialogs (confirm, import) ────────────────────────────────────────────── */
.uc-portal:has(.cf-dlg) { width: min(calc(100vw - 32px), 440px); }
.uc-portal:has(.cf-dlg--md) { width: min(calc(100vw - 32px), 520px); }
.cf-dlg__msg { white-space: pre-line; }

/* Notices above the list (model problems, open migration). */
.cf-notice { display: flex; flex-direction: column; align-items: flex-start; gap: var(--uc-space-6); }
.cf-notice__list { margin: 0; padding-inline-start: var(--uc-space-16); }

/*
 * Custom Fields — design-system look for the field builder (forms, field-group builder, migrate).
 *
 *  1. Base font for the screen and its dialogs.
 *  2. Styles for the kit adapters (components/ui/kit.jsx): Field, Radio, MultiSelect, dialogs.
 *
 * Layout / text utilities (uich-ui-*) live in src/uich-ui.css and read --uc-* tokens directly.
 */

/* ── 1. Base ───────────────────────────────────────────────────────────────── */
.uich-fields-screen,
.uc-portal:has(.cf-dlg) {
	font-family: var(--uc-font-sans);
}

/* ── 2. Kit adapters ───────────────────────────────────────────────────────── */

/* Field: label row, control, hint / error. */
.cf-field { display: flex; flex-direction: column; gap: var(--uc-space-6); min-width: 0; }
.cf-field__head { display: flex; align-items: center; gap: var(--uc-space-6); min-height: 18px; }
.cf-field__label { font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); line-height: 1.3; }
.cf-field__req { color: var(--uc-danger); }
.cf-field__hint { font-size: var(--uc-text-11); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); }
.cf-field__error { font-size: var(--uc-text-11); line-height: var(--uc-leading-snug); color: var(--uc-danger-fg, var(--uc-danger)); }
.cf-field > [class*="input"], .cf-field > span:not([class]) { width: 100%; }

/* Tooltip (i) trigger. */
.cf-kit-tip { display: inline-flex; align-items: center; }
.cf-kit-tip--icon { color: var(--uc-text-subtle); cursor: help; border-radius: var(--uc-radius-pill); }
.cf-kit-tip--icon:hover { color: var(--uc-text-strong); }
.cf-kit-tip__body { display: block; max-width: 280px; white-space: normal; }

/* Toggle / Checkbox with label. */
.cf-kit-toggle, .cf-kit-check { display: inline-flex; align-items: center; gap: var(--uc-space-8); min-width: 0; }
.cf-kit-toggle__label, .cf-kit-check__label { font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); cursor: pointer; }
.cf-kit-check.is-disabled .cf-kit-check__label { color: var(--uc-text-subtle); cursor: not-allowed; }
.cf-pro-badge { gap: var(--uc-space-2); cursor: pointer; }

/* Radio (native input, DS look). */
.cf-kit-radiogroup { display: inline-flex; flex-wrap: wrap; gap: var(--uc-space-8) var(--uc-space-16); }
.cf-kit-radio { position: relative; display: inline-flex; align-items: center; gap: var(--uc-space-8); cursor: pointer; font-size: var(--uc-text-xs); color: var(--uc-text-strong); }
.cf-kit-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.cf-kit-radio__dot { flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--uc-surface-control); box-shadow: inset 0 0 0 1px var(--uc-border-strong); transition: box-shadow var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-kit-radio.is-checked .cf-kit-radio__dot { box-shadow: inset 0 0 0 5px var(--uc-text-strong); }
.cf-kit-radio input:focus-visible + .cf-kit-radio__dot { outline: 2px solid var(--uc-ring); outline-offset: 2px; }
.cf-kit-radio.is-disabled { cursor: not-allowed; color: var(--uc-text-subtle); }
.cf-kit-radio__label { min-width: 0; }

/* Dropdown (DS Select). */
.cf-kit-select[class] { width: 100%; min-width: 0; justify-content: space-between; }
.cf-kit-select__divider { height: 1px; margin: var(--uc-space-4) 0; background: var(--uc-border-subtle); }
.cf-kit-select__header { padding: var(--uc-space-6) var(--uc-space-8) var(--uc-space-2); font-size: var(--uc-text-11); color: var(--uc-text-muted); }
.cf-kit-select__sub { color: var(--uc-text-muted); }

/* MultiSelect: chips in a Select-look trigger, check list in the dark popover. */
.cf-kit-multi[class] { width: 100%; min-height: var(--uc-control-h-md); height: auto; padding-block: var(--uc-space-4); }
.cf-kit-multi__chips { display: flex; flex-wrap: wrap; gap: var(--uc-space-4); min-width: 0; }
.cf-kit-multi__x { display: inline-grid; vertical-align: middle; margin-right: var(--uc-space-2); place-items: center; width: 16px; height: 16px; border-radius: var(--uc-radius-4); color: var(--uc-text-muted); cursor: pointer; }
.cf-kit-multi__x:hover { background: var(--uc-border); color: var(--uc-text-strong); }
.cf-kit-multi__pop { min-width: var(--radix-popover-trigger-width); max-width: min(420px, 92vw); padding: 0; }
.cf-kit-multi__search { padding: var(--uc-space-6); border-bottom: 1px solid var(--uc-border-subtle); }
.cf-kit-multi__list { max-height: 260px; overflow-y: auto; padding: var(--uc-space-4); }
.cf-kit-multi__group { padding: var(--uc-space-6) var(--uc-space-8) var(--uc-space-2); font-size: var(--uc-text-11); color: var(--uc-text-muted); }
.cf-kit-multi__opt { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: var(--uc-space-8); width: 100%; min-height: 30px; padding: 0 var(--uc-space-8); border-radius: var(--uc-radius-6); font-size: var(--uc-text-xs); color: var(--uc-text); cursor: pointer; }
.cf-kit-multi__opt:hover, .cf-kit-multi__opt:focus-visible { background: var(--uc-surface-overlay); color: var(--uc-text-strong); }
.cf-kit-multi__opt[disabled] { opacity: .5; cursor: not-allowed; }
.cf-kit-multi__tick { flex: none; display: grid; place-items: center; width: 16px; height: 16px; border-radius: var(--uc-radius-4); box-shadow: inset 0 0 0 1px var(--uc-border-strong); }
.cf-kit-multi__opt.is-on .cf-kit-multi__tick { background: var(--uc-text-strong); color: var(--uc-surface-base); box-shadow: none; }
.cf-kit-multi__optlabel { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-kit-multi__empty { padding: var(--uc-space-12); font-size: var(--uc-text-xs); color: var(--uc-text-muted); text-align: center; }
.cf-kit-multi__foot { display: flex; align-items: center; justify-content: space-between; padding: var(--uc-space-6) var(--uc-space-10); border-top: 1px solid var(--uc-border-subtle); font-size: var(--uc-text-11); color: var(--uc-text-muted); }

.cf-kit-search { display: block; width: 100%; }
.cf-kit-search > span { width: 100%; }
.cf-kit-tabs { display: flex; flex-direction: column; gap: var(--uc-space-16); min-width: 0; }
.cf-kit-alert[class] { width: 100%; }
.cf-kit-alert--noicon > span:first-child { display: none; }
.cf-kit-spinner { display: inline-flex; color: var(--uc-text-muted); }
.cf-kit-sep--v[class] { align-self: stretch; height: auto; min-height: 14px; }
.cf-kit-sep-label { display: flex; align-items: center; gap: var(--uc-space-8); font-size: var(--uc-text-11); color: var(--uc-text-muted); }
.cf-kit-sep-label > [role="none"], .cf-kit-sep-label > [data-orientation] { flex: 1; }
.cf-btn--quiet[class] { --_h: auto; height: auto; padding: 0; color: var(--uc-text-muted); background: none; }
.cf-btn--quiet[class]:hover { color: var(--uc-text-strong); background: none; }
.cf-confirm-btn--danger[class] { color: var(--uc-danger-fg, var(--uc-danger)); }

/* Dialog sizes (Modal adapter). */
.uc-portal:has(.cf-dlg--sm) { width: min(calc(100vw - 32px), 440px); }
.uc-portal:has(.cf-dlg--lg) { width: min(calc(100vw - 32px), 720px); }
.uc-portal:has(.cf-dlg--xl) { width: min(calc(100vw - 32px), 920px); }
.uc-portal:has(.cf-dlg--full) { width: calc(100vw - 32px); }
/* overflow-y: auto also clips x, which cut off the inputs' focus ring (a 1px outline + 1px offset
   drawn OUTSIDE the field). 4px of padding on every side gives the ring room; the matching negative
   margin cancels it, so the content sits exactly where it did. The inline-end padding is 4px more to
   keep the original 4px between the content and the scrollbar. */
.cf-dlg__body { max-height: min(70vh, 720px); overflow-y: auto; scrollbar-gutter: stable; margin: calc(-1 * var(--uc-space-4)); padding: var(--uc-space-4); padding-inline-end: var(--uc-space-8); }
.cf-dlg__foot { justify-content: space-between; }
.cf-dlg__actions { display: flex; align-items: center; gap: var(--uc-space-8); margin-right: auto; }

/* ── 3. Form page (FormModal) ──────────────────────────────────────────────── */
.cf-form { display: flex; flex-direction: column; gap: var(--uc-space-16); min-width: 0; }

.cf-aside-list { margin: 0; padding: var(--uc-space-4); list-style: none; }
.cf-aside-list li { margin: 0; }
.cf-aside-list button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: var(--uc-space-8); width: 100%; padding: var(--uc-space-6) var(--uc-space-10); border-radius: var(--uc-radius-8); cursor: pointer; }
.cf-aside-list button:hover { background: var(--uc-surface-base); }
.cf-aside-list button:focus-visible { outline: 2px solid var(--uc-ring); outline-offset: -2px; }
.cf-aside-list__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-aside-list__meta { flex: none; font-size: var(--uc-text-11); color: var(--uc-text-muted); }
.cf-row-ico--sm[class] { width: 24px; height: 24px; border-radius: var(--uc-radius-6); }

.cf-glance { margin: 0; padding: var(--uc-space-6) var(--uc-space-14) var(--uc-space-10); }
.cf-glance > div { display: flex; align-items: baseline; justify-content: space-between; gap: var(--uc-space-12); padding: var(--uc-space-6) 0; border-top: 1px solid var(--uc-border-subtle); }
.cf-glance > div:first-child { border-top: 0; }
.cf-glance dt { flex: none; font-size: var(--uc-text-11); color: var(--uc-text-muted); }
.cf-glance dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--uc-text-xs); color: var(--uc-text-strong); text-align: left; }

.cf-skel--panel { height: 420px; border-radius: var(--uc-radius-16); }

/* Old section cards inside the forms: same white card + hairline as DS <Card variant="outline">. */
.cf-edit-main .uich-ui-bg-default.uich-ui-border.uich-ui-rounded-md { border-color: var(--uc-border); border-radius: var(--uc-radius-12); }

/* ── 4. Settings rows, tabs, vertical nav ──────────────────────────────────── */
/* flex: none: long help text wrapping must never squeeze the switch into the label. */

.cf-vnav { display: flex; flex-direction: column; gap: var(--uc-space-2); min-width: 180px; max-width: 220px; }
.cf-vnav-item[class] { justify-content: flex-start; width: 100%; color: var(--uc-text-muted); }
.cf-vnav-item.is-active[class] { background: var(--uc-surface-base); color: var(--uc-text-strong); }

/* ── 5. Field-group builder bits (app.css shapes, UiChemy look) ───────────── */
.uich-ct-type-card[class] { align-items: flex-start; padding: var(--uc-space-12) var(--uc-space-14); border: 0; border-radius: var(--uc-radius-12); box-shadow: inset 0 0 0 1px var(--uc-border); background: var(--uc-surface-raised); }
.uich-ct-type-card[class]:hover { border: 0; box-shadow: inset 0 0 0 1px var(--uc-border-strong); }
.uich-ct-type-card[class]:focus-visible { border: 0; box-shadow: 0 0 0 2px var(--uc-ring); }
.uich-ct-type-card__icon[class], .uich-ct-field-settings__icon[class] { flex: 0 0 32px; width: 32px; height: 32px; border: 1px solid var(--uc-border-subtle); border-radius: var(--uc-radius-8); background: var(--uc-surface-base); color: var(--uc-text-strong); }
.uich-ct-type-card__text { display: flex; flex-direction: column; gap: var(--uc-space-2); min-width: 0; }
.uich-ct-type-card__label[class] { font-size: var(--uc-text-sm); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.uich-ct-type-card__desc { font-size: var(--uc-text-11); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); }
.uich-ct-type-card.is-locked .uich-ct-type-card__icon[class] { color: var(--uc-text-subtle); }

.uich-ct-choices__add[class] { color: var(--uc-text-strong); }
.uich-ct-choices__add[class]:hover { background: var(--uc-surface-base); }

.uich-ct-icon-swatch:focus-visible { outline-color: var(--uc-ring); }
.uich-ct-icon-swatch.is-selected { border-color: var(--uc-text-strong); background: var(--uc-surface-base); }
.uich-ct-icon-preview { border-color: var(--uc-border); border-radius: var(--uc-radius-8); }
.uich-gf-pro-lock { border-color: var(--uc-border); border-radius: var(--uc-radius-12); background: var(--uc-surface-base); }
.uich-gf-pro-lock-icon, .uich-gf-pro-lock-text .description { color: var(--uc-text-muted); }

/* Location / conditional rule rows: selects share the line and wrap as a group (app.css targets
   the old dropdown wrapper, which the DS Select does not render). */
.uich-ct-rule-row > .cf-kit-select[class] { flex: 1 1 160px; width: auto; min-width: 0; }
.uich-ct-rule-row > .cf-kit-multi[class] { flex: 1 1 200px; width: auto; }
.uich-ct-rule-row > .cf-btn { flex: 0 0 auto; }

/* Migrate wizard step numbers: neutral, like the tab counts (current = ink, done = check). */
.cf-step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--uc-radius-pill); box-shadow: inset 0 0 0 1px var(--uc-border-strong); font-size: var(--uc-text-11); font-weight: var(--uc-weight-medium); color: var(--uc-text-muted); }
.cf-step.is-current { background: var(--uc-text-strong); color: var(--uc-surface-raised); box-shadow: none; }
.cf-step.is-done { background: var(--uc-surface-sunken); color: var(--uc-text-strong); box-shadow: none; }

/* ── 6. Editor page (FormModal), editor layout ─────────────── */
.cf-edit { display: flex; flex-direction: column; gap: var(--uc-space-16); min-width: 0; }
/* One row: breadcrumb (current crumb = the name, edited in place), save-state badge, actions. */
.cf-edit-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--uc-space-8); min-height: 36px; padding-bottom: var(--uc-space-12); border-bottom: 1px solid var(--uc-border-subtle); }
.cf-crumbs[class] { min-width: 0; padding: 3px; margin: -3px calc(var(--uc-space-4) * -1 - 3px) -3px -3px; }
.cf-crumb-name { display: inline-flex; align-items: center; gap: var(--uc-space-2); min-width: 0; max-width: min(420px, 60vw); cursor: text; }
.cf-title-fit { display: inline-grid; min-width: 0; max-width: 100%; }
.cf-title-fit > .cf-title-input, .cf-title-fit::after { grid-area: 1 / 1; }
.cf-title-fit > .cf-title-input { width: 100%; }
.cf-title-fit::after { content: attr(data-fit) " "; visibility: hidden; white-space: pre; overflow: hidden; padding: 0 var(--uc-space-8); font-size: var(--uc-text-sm); line-height: 28px; font-weight: var(--uc-weight-medium); }
.cf-title-input[class] { min-width: 0; max-width: 100%; height: var(--uc-control-h-sm); min-height: 0; margin: 0; padding: 0 var(--uc-space-8); border: 0; border-radius: var(--uc-input-radius, var(--uc-radius-md)); background: transparent; box-shadow: none; font: inherit; font-size: var(--uc-text-sm); line-height: 28px; font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); transition: background var(--uc-dur-fast) var(--uc-ease-standard), box-shadow var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-title-input[class]:hover { background: var(--uc-surface-base); }
.cf-title-input[class]:focus { outline: 1px solid var(--uc-brand); outline-offset: 1px; background: var(--uc-surface-overlay); box-shadow: inset 0 0 0 1px var(--uc-border-strong), var(--uc-shadow-input); }
.cf-title-input[class]::-moz-placeholder { color: var(--uc-text-subtle); }
.cf-title-input[class]::placeholder { color: var(--uc-text-subtle); }
.cf-title-input.is-empty[class]:not(:focus) { box-shadow: inset 0 0 0 1px var(--uc-border-strong); }
.cf-title-input.is-invalid[class]:not(:focus) { box-shadow: inset 0 0 0 1px var(--uc-danger); background: var(--uc-danger-soft); }
.cf-title-edit { flex: none; display: inline-flex; color: var(--uc-text-subtle); opacity: 0; transition: opacity var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-crumb-name:hover .cf-title-edit { opacity: 1; }
.cf-crumb-name:focus-within .cf-title-edit { opacity: 0; }
.cf-save-wrap { display: inline-flex; }
.cf-edit-actions { display: flex; align-items: center; gap: var(--uc-space-6); margin-right: auto; }
.cf-edit-status { display: inline-flex; align-items: center; gap: var(--uc-space-6); margin-left: var(--uc-space-8); font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); cursor: pointer; }
.cf-edit-alert ul { margin: var(--uc-space-4) 0 0; padding-inline-start: 18px; font-size: var(--uc-text-xs); }

/* Form + inspector, each a grey tray holding white cards (the DS Dialog tray). */
.cf-edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--uc-space-16); align-items: start; }
.cf-edit-main, .cf-edit-side { display: flex; flex-direction: column; gap: var(--uc-space-8); min-width: 0; padding: var(--uc-space-8); border-radius: var(--uc-radius-16); background: var(--uc-surface-base); }
.cf-edit-main > .uich-ui-flex { gap: var(--uc-space-8) !important; }
/* Below the sticky header row. */
/* 57px = the stuck header's visible height (41px) + the grid gap (16px): the panel's resting place, so
   it lines up with the main panel's top instead of starting 7px lower. */
@media (min-width: 1101px) { .cf-edit-side { position: sticky; top: 57px; } }
@media (max-width: 1100px) { .cf-edit-grid { grid-template-columns: 1fr; } }
@media (max-width: 782px) {
	.cf-edit-actions { width: 100%; flex-wrap: wrap; margin-right: 0; }
	.cf-edit-actions > .cf-save-wrap { flex: 1 1 auto; }
	.cf-save-wrap > button { width: 100%; }
}

/* Inspector: box accordion, each section its own outline card; trigger = label + value. */
.cf-insp > [data-orientation] { display: flex; flex-direction: column; gap: var(--uc-space-8); }
.cf-insp-bar { display: flex; justify-content: flex-end; padding: 0 var(--uc-space-4) var(--uc-space-6); }
.cf-insp-item[class] { overflow: hidden; border: 0; border-radius: var(--uc-radius-12); background: var(--uc-surface-raised); box-shadow: inset 0 0 0 1px var(--uc-border); transition: box-shadow var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-insp-item[data-state="open"], .cf-insp-item[class]:not([data-state="open"]):hover { box-shadow: inset 0 0 0 1px var(--uc-border-strong); }
.cf-insp h3 { margin: 0; }
.cf-insp h3 > button { padding: var(--uc-space-10) var(--uc-space-12); font-size: var(--uc-text-xs); gap: var(--uc-space-8); }
.cf-insp h3 > button svg { width: 14px; height: 14px; }
.cf-insp h3 > button:hover .cf-insp-value { color: var(--uc-text-strong); }
.cf-insp h3 > button:focus-visible { outline-offset: -2px; border-radius: var(--uc-radius-12); }
.cf-insp [role="region"] > div { padding: var(--uc-space-2) var(--uc-space-12) var(--uc-space-12); }
.cf-insp-label { flex: none; font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-insp-value { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-weight: var(--uc-weight-regular); color: var(--uc-text-muted); }
.cf-insp-value--mono { font-family: var(--uc-font-mono); font-size: var(--uc-text-11); }
.cf-insp-form { display: flex; flex-direction: column; gap: var(--uc-space-10); min-width: 0; }
.cf-insp-hint { margin: 0; font-size: var(--uc-text-11); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); }
.cf-insp-add[class] { align-self: flex-start; }
.cf-insp .cf-aside-list { padding: 0; margin: 0 calc(var(--uc-space-8) * -1); }
.cf-insp .cf-glance { padding: 0; }

.cf-skel--crumb { width: 260px; height: 20px; }
.cf-skel--btn { width: 120px; height: 28px; margin-right: auto; }
.cf-skel--side { height: 260px; border-radius: var(--uc-radius-12); }

/* ── 7. Checkbox setting cards + "add" tile (Supports grid) ──────────────── */

/* The "add" tile sits in the card grid: same footprint as a card, dashed edge, quiet until hover. */
.cf-addcard[class] { --_h: auto; height: auto; min-height: 56px; width: 100%; justify-content: center; gap: var(--uc-space-6); padding: var(--uc-space-12); border-radius: var(--uc-radius-12); background: transparent; box-shadow: none; outline: 1px dashed var(--uc-border-strong); outline-offset: -1px; font-size: var(--uc-text-xs); color: var(--uc-text-muted); }
.cf-addcard[class]:hover:not(:disabled) { background: var(--uc-surface-raised); color: var(--uc-text-strong); outline-color: var(--uc-text-subtle); }
.cf-addcard[class]:focus-visible { outline: 2px solid var(--uc-ring); outline-offset: 2px; }

/* Rotating chevrons (adapter icons). */
.cf-rot { transition: transform var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-rot.is-up { transform: rotate(-180deg); }

/* ── 7. Post type / taxonomy editor: layout around DS components ────────────────────────────
   Cards are DS <Card variant="outline">, settings are DS <SwitchCard variant="row">, options are
   DS <CheckboxCard>, presets are DS <Chip>, Advanced is DS <Accordion>. These rules only place
   them; colour, radius and type come from the components and the uc- tokens. */
.cf-edit-main { gap: var(--uc-space-12); }

/* The header stays in view while the long Advanced sections scroll (the dashboard's main column
   is the scroll container on desktop; on narrow screens the window scrolls, so it stays static).
   A sticky top: 0 stops inside the scroller's padding (.nd-shell__main pads 40px), which left a band
   above the header where the cards scrolled into view; so it sticks at the scroller's edge instead and
   paints that band itself. */
.cf-edit-head--sticky { position: sticky; top: -40px; z-index: 5; margin-top: -40px; padding-top: 40px; background: var(--uc-surface-raised); }
@media (max-width: 782px) { .cf-edit-head--sticky { position: static; margin-top: 0; padding-top: 0; } }

.cf-form { display: flex; flex-direction: column; gap: var(--uc-space-12); min-width: 0; }

/* DS Card: tighter pad through the card's own --uc-card-pad hook, and a one-row header. */
.cf-card { --uc-card-pad: var(--uc-space-16); min-width: 0; }
.cf-card__head[class] { flex-direction: row; align-items: center; gap: var(--uc-space-12); padding-bottom: var(--uc-space-12); border-bottom: 1px solid var(--uc-border-subtle); }
.cf-card__titles { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--uc-space-2); min-width: 0; }
.cf-card__title[class] { margin: 0; font-size: var(--uc-text-base); }
.cf-card__hint[class] { margin: 0; font-size: var(--uc-text-xs); }
.cf-card__aside { flex: none; display: flex; align-items: center; gap: var(--uc-space-8); }
/* 1px inset: the DS Card draws its border as an inset shadow, which row backgrounds would paint over. */
.cf-card--flush > .cf-card__body[class] { padding: 0 1px 1px; gap: 0; }

.cf-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--uc-space-16) var(--uc-space-20); min-width: 0; }
.cf-span2 { grid-column: 1 / -1; min-width: 0; }
@media (max-width: 782px) { .cf-grid2 { grid-template-columns: minmax(0, 1fr); } }

/* Live URL inside a field hint. */
.cf-urlprev { display: inline-flex; align-items: center; gap: var(--uc-space-6); max-width: 100%; min-width: 0; }
.cf-urlprev > svg { flex: none; }
.cf-urlprev__url { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--uc-font-mono); color: var(--uc-text-strong); }
/* Was --uc-text-subtle (#A3A3A3, 2.52:1 on white); the muted token is 5.74:1 on white here. */
.cf-urlprev__suffix { color: var(--uc-text-muted); }
.cf-tpl__note { color: var(--uc-text-muted); }

/* DS Accordion as the Advanced list. */
.cf-adv-item[class] { border-bottom: 0; border-top: 1px solid var(--uc-border-subtle); }
.cf-adv-item[class]:first-child { border-top: 0; }
.cf-adv-trigger[class] { gap: var(--uc-space-12); padding: var(--uc-space-12) var(--uc-space-16); font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); transition: background var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-adv-trigger[class]:hover { background: var(--uc-surface-base); }
.cf-adv-trigger[class]:focus-visible { outline-offset: -2px; border-radius: 0; }
.cf-adv-ico { flex: none; display: inline-grid; place-items: center; width: var(--uc-control-h-sm); height: var(--uc-control-h-sm); border-radius: var(--uc-radius-8); background: var(--uc-surface-base); color: var(--uc-text-strong); }
.cf-adv-trigger[data-state="open"] .cf-adv-ico { background: var(--uc-surface-raised); box-shadow: inset 0 0 0 1px var(--uc-border); }
.cf-adv-title { flex: none; color: var(--uc-text-strong); }
.cf-adv-sum { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-weight: var(--uc-weight-regular); color: var(--uc-text-muted); }
.cf-adv-item [role="region"] > div { padding: 0; }
.cf-adv-body { display: flex; flex-direction: column; min-width: 0; border-top: 1px solid var(--uc-border-subtle); color: var(--uc-text-strong); }
.cf-adv-note[class] { margin: var(--uc-space-12) var(--uc-space-16) var(--uc-space-4); }
.cf-adv-field { padding: var(--uc-space-12) var(--uc-space-16); border-bottom: 1px solid var(--uc-border-subtle); }
.cf-adv-lead[class] { margin: var(--uc-space-12) var(--uc-space-16) 0; font-size: var(--uc-text-11); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); }
.cf-adv-pad { padding: var(--uc-space-12) var(--uc-space-16) var(--uc-space-16); }
.cf-disclose[class] { align-self: flex-start; gap: var(--uc-space-6); margin-right: calc(var(--uc-space-8) * -1); }
@media (max-width: 600px) { .cf-adv-sum { display: none; } }

/* Labels section: the hand-edited ones, everything else behind "Edit all". */
.cf-labels { display: flex; flex-direction: column; gap: var(--uc-space-12); padding: var(--uc-space-12) var(--uc-space-16) var(--uc-space-16); min-width: 0; }
.cf-labels__bar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--uc-space-8); }
.cf-labels__hint[class] { flex: 1 1 220px; margin: 0; font-size: var(--uc-text-11); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); }
.cf-labels__all { display: flex; align-items: flex-start; gap: var(--uc-space-16); min-width: 0; }
.cf-labels__panel { flex: 1 1 auto; }
@media (max-width: 782px) { .cf-labels__all { flex-direction: column; } .cf-labels__all .cf-vnav { max-width: none; width: 100%; } }

/* Editor features: DS CheckboxCards in a grid, plus the dashed "add" tile. */
.cf-checkcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--uc-space-8); }
.cf-checkcards > .cf-addcard[class] { min-height: 0; height: auto; }
.cf-adv-caps { display: flex; flex-direction: column; gap: var(--uc-space-8); padding-top: 0; }

/* ── 8. Field group: fields builder, field rows, settings modal, live preview ─────────────────
   The top-level builder is a DS Card (FormCard); repeater sub fields use the dense block. */
.cf-fbuilder-wrap { min-width: 0; }
.cf-fbuilder .cf-card__title .cf-tab-count, .cf-fbuilder__title .cf-tab-count { margin-right: var(--uc-space-6); vertical-align: 1px; }

.cf-flist { display: flex; flex-direction: column; min-width: 0; }
.cf-frow { display: flex; align-items: center; gap: var(--uc-space-10); min-width: 0; padding: var(--uc-space-10) var(--uc-space-8) var(--uc-space-10) var(--uc-space-16); border-top: 1px solid var(--uc-border-subtle); background: transparent; cursor: pointer; transition: background var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-frow:first-child { border-top: 0; }
.cf-flist > .cf-frow:last-child { border-radius: 0 0 calc(var(--uc-radius-12) - 1px) calc(var(--uc-radius-12) - 1px); }
.cf-frow.is-dragging { background: var(--uc-surface-raised); }
.cf-frow:hover, .cf-frow.is-open { background: var(--uc-surface-base); }
.cf-frow:focus-visible { outline: 2px solid var(--uc-ring); outline-offset: -2px; }
.cf-frow.is-dragging { border-radius: var(--uc-radius-8); box-shadow: var(--uc-shadow-4), inset 0 0 0 1px var(--uc-border); }
.cf-frow__grip { flex: none; display: inline-grid; place-items: center; width: 24px; min-width: 24px; min-height: 24px; height: var(--uc-control-h-sm); border-radius: var(--uc-radius-6); color: var(--uc-text-subtle); cursor: grab; }
.cf-frow__grip:hover { background: var(--uc-surface-sunken); color: var(--uc-text-strong); }
.cf-frow__grip:active { cursor: grabbing; }
/* The select button is the row's one tab stop for opening a field; the handle and menu are its siblings. */
.cf-frow__select { flex: 1 1 auto; display: flex; align-items: center; gap: var(--uc-space-10); min-width: 0; margin: 0; padding: 0; border: 0; border-radius: var(--uc-radius-6); background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.cf-frow__select:focus-visible { outline: 2px solid var(--uc-ring); outline-offset: 2px; }
.cf-frow__text { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--uc-space-2); min-width: 0; }
.cf-frow__text > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-frow__text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--uc-text-11); color: var(--uc-text-muted); }
.cf-frow__menu { flex: none; display: inline-flex; }

/* Repeater sub fields, inside the settings modal. */
.cf-fbuilder--dense { min-width: 0; border-radius: var(--uc-radius-12); background: var(--uc-surface-raised); box-shadow: inset 0 0 0 1px var(--uc-border); }
.cf-fbuilder__head { display: flex; align-items: center; justify-content: space-between; gap: var(--uc-space-8); padding: var(--uc-space-8) var(--uc-space-12) var(--uc-space-8) var(--uc-space-8); border-bottom: 1px solid var(--uc-border-subtle); }
.cf-fbuilder__title { font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-fbuilder--dense .cf-frow { padding-left: var(--uc-space-8); }

/* Settings modal: the settings, and beside them what an editor will see. */
/* Sub-field dialog: the same stack as the side panel, preview on top. */
.cf-fsettings__stack { display: flex; flex-direction: column; gap: var(--uc-space-16); min-width: 0; }
.cf-fsettings .uich-ct-field-settings__tabs { justify-content: flex-start; }
.cf-fsettings__type { font-size: var(--uc-text-sm); font-weight: var(--uc-weight-regular); color: var(--uc-text-muted); }
.uich-ct-field-settings__title { gap: var(--uc-space-8); }

/* Live preview of one field. */
.cf-pv { display: flex; flex-direction: column; gap: var(--uc-space-8); min-width: 0; padding: var(--uc-space-12); border-radius: var(--uc-radius-12); background: var(--uc-surface-base); }
.cf-pv__tag { font-size: var(--uc-text-11); font-weight: var(--uc-weight-medium); color: var(--uc-text-muted); }
.cf-pv__field { display: flex; flex-direction: column; gap: var(--uc-space-6); min-width: 0; padding: var(--uc-space-12); border-radius: var(--uc-radius-8); background: var(--uc-surface-raised); box-shadow: inset 0 0 0 1px var(--uc-border-subtle); pointer-events: none; }
.cf-pv__label { font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); overflow-wrap: anywhere; }
.cf-pv__help { font-size: var(--uc-text-11); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); overflow-wrap: anywhere; }
.cf-pv-muted { color: var(--uc-text-subtle); }
.cf-pv-select { display: flex; align-items: center; justify-content: space-between; gap: var(--uc-space-8); height: var(--uc-control-h-sm); padding: 0 var(--uc-space-10); border-radius: var(--uc-radius-md); background: var(--uc-surface-raised); box-shadow: inset 0 0 0 1px var(--uc-border); font-size: var(--uc-text-xs); color: var(--uc-text-strong); }
.cf-pv-select > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-pv-select > svg { flex: none; color: var(--uc-text-muted); }
.cf-pv-choices { display: flex; flex-direction: column; gap: var(--uc-space-6); }

.cf-pv-choice { display: inline-flex; align-items: center; gap: var(--uc-space-8); font-size: var(--uc-text-xs); color: var(--uc-text-strong); }
.cf-pv-choice .cf-kit-radio__dot.is-on { box-shadow: inset 0 0 0 5px var(--uc-text-strong); }
.cf-pv-media { display: flex; align-items: center; gap: var(--uc-space-8); padding: var(--uc-space-10); border-radius: var(--uc-radius-8); outline: 1px dashed var(--uc-border-strong); outline-offset: -1px; font-size: var(--uc-text-xs); color: var(--uc-text-muted); }
.cf-pv-media > span { flex: 1 1 auto; min-width: 0; }
.cf-pv-rich { overflow: hidden; border-radius: var(--uc-radius-md); box-shadow: inset 0 0 0 1px var(--uc-border); }
.cf-pv-rich__bar { display: flex; align-items: center; gap: var(--uc-space-10); padding: var(--uc-space-6) var(--uc-space-10); border-bottom: 1px solid var(--uc-border-subtle); background: var(--uc-surface-base); font-size: var(--uc-text-xs); color: var(--uc-text-muted); }
.cf-pv-rich__body { min-height: 56px; padding: var(--uc-space-8) var(--uc-space-10); font-size: var(--uc-text-xs); color: var(--uc-text-strong); }
.cf-pv-color { display: flex; align-items: center; gap: var(--uc-space-8); font-size: var(--uc-text-xs); }
.cf-pv-color__swatch { flex: none; width: 24px; height: 24px; border-radius: var(--uc-radius-6); box-shadow: inset 0 0 0 1px var(--uc-border); }
.cf-pv-repeater { overflow: hidden; border-radius: var(--uc-radius-md); box-shadow: inset 0 0 0 1px var(--uc-border); }
.cf-pv-repeater__row { display: flex; gap: var(--uc-space-6); padding: var(--uc-space-8); font-size: var(--uc-text-11); }
.cf-pv-repeater__cell { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: var(--uc-space-4) var(--uc-space-8); border-radius: var(--uc-radius-6); background: var(--uc-surface-base); color: var(--uc-text-muted); }
.cf-pv-repeater__add { display: flex; align-items: center; gap: var(--uc-space-6); padding: var(--uc-space-8); border-top: 1px solid var(--uc-border-subtle); font-size: var(--uc-text-xs); color: var(--uc-text-strong); }
.cf-wrapper-attrs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--uc-space-12); }
@media (max-width: 600px) { .cf-wrapper-attrs { grid-template-columns: minmax(0, 1fr); } }
/* Four settings tabs (Validation appears for some types) are wider than a phone dialog: let the
   strip scroll sideways instead of spilling out of the card. */
@media (max-width: 600px) {
	.uich-ct-field-settings__tabs { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
	.uich-ct-field-settings__tabs::-webkit-scrollbar { display: none; }
	.uich-ct-field-settings__tabs [role="tablist"] { flex: none; }
}

/* ── 9. Field group: fields workspace ────────────
   A grey frame (DS Card) holds the field list, as the file tree, and inset beside it one white card
   with the open field's settings, the type picker or a prompt. The list stays visible while a field
   is open, so moving between fields is one click. `is-stacked` (set from the measured width, see
   FieldsBuilderSection) puts the card under the list when the main column is narrow. */
/* overflow: visible because the DS Card clips (hidden), which made the card the sticky pane's scroll
   box: settings shorter than the card were pushed 64px down from its top instead of following the page. */
.cf-ws[class] { min-width: 0; padding: 0; overflow: visible; background: var(--uc-surface-base); }
.cf-ws-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 520px; min-width: 0; }
.cf-ws-list { display: flex; flex-direction: column; min-width: 0; }
.cf-ws-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--uc-space-8); height: 36px; padding: 0 var(--uc-space-10) 0 var(--uc-space-4); }
.cf-ws-title { display: inline-flex; align-items: center; gap: var(--uc-space-6); font-size: var(--uc-text-2xs); font-weight: var(--uc-weight-medium); letter-spacing: var(--uc-tracking-wide); text-transform: uppercase; color: var(--uc-text-muted); }
.cf-ws-bar button { --_h: 26px; width: 26px; min-width: 26px; }
.cf-ws-bar button svg { width: 14px; height: 14px; }

/* Rows sit on the frame like tree rows: no rules between them, the open one lifted onto a white chip. */
.cf-ws-list .cf-flist { gap: var(--uc-space-2); padding: 0 var(--uc-space-4) var(--uc-space-6); }
.cf-ws-list .cf-frow { gap: var(--uc-space-8); padding: var(--uc-space-6) var(--uc-space-2) var(--uc-space-6) var(--uc-space-4); border-top: 0; border-radius: var(--uc-radius-8); }
.cf-ws-list .cf-flist > .cf-frow:last-child { border-radius: var(--uc-radius-8); }
.cf-ws-list .cf-frow:hover { background: var(--uc-surface-sunken); }
.cf-ws-list .cf-frow.is-open { background: var(--uc-surface-raised); box-shadow: inset 0 0 0 1px var(--uc-border); }
.cf-ws-list .cf-frow .cf-row-ico { background: var(--uc-surface-raised); }
.cf-ws-pane { display: flex; flex-direction: column; min-width: 0; padding: var(--uc-space-6) 0 var(--uc-space-6) var(--uc-space-6); }
.cf-ws-card { flex: 1 1 auto; min-width: 0; border: 1px solid var(--uc-border); border-radius: var(--uc-radius-md); background: var(--uc-surface-raised); }
.cf-ws-slot:empty { display: none; }
.cf-pv-range { display: flex; align-items: center; gap: var(--uc-space-8); min-width: 0; }
.cf-pv-range > :not(.cf-pv-range__affix) { flex: 1 1 auto; min-width: 0; }
.cf-pv-range__affix { flex: none; font-size: var(--uc-text-xs); color: var(--uc-text-muted); }
.cf-ws-idle { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--uc-space-6); min-height: 320px; height: 100%; padding: var(--uc-space-24); text-align: center; }
/* Side by side, a field low in a long list must not open its settings off screen: the card's
   content follows the scroll under the sticky header and scrolls on its own when it runs long. */
.cf-ws-body:not(.is-stacked) .cf-ws-card > .cf-ws-slot:not(:empty),
.cf-ws-body:not(.is-stacked) .cf-ws-card > .cf-fpick,
.cf-ws-body:not(.is-stacked) .cf-ws-card > .cf-ws-idle {
	position: sticky;
	top: 64px;
	max-height: calc(100vh - 140px);
	overflow-y: auto;
	overscroll-behavior: contain;
}
.cf-ws-body.is-stacked { grid-template-columns: minmax(0, 1fr); min-height: 0; }
.cf-ws-body.is-stacked .cf-ws-pane { padding: 0 var(--uc-space-6) var(--uc-space-6); }
.cf-ws-body.is-stacked .cf-ws-idle { min-height: 200px; }

/* Open field: header, live preview, then the settings. */
.cf-fpanel { display: flex; flex-direction: column; gap: var(--uc-space-12); min-width: 0; padding: var(--uc-space-12) var(--uc-space-16) var(--uc-space-16); }
.cf-fpanel__head { display: flex; align-items: center; gap: var(--uc-space-8); min-width: 0; }
.cf-fpanel__title { flex: 1 1 auto; display: flex; align-items: baseline; gap: var(--uc-space-8); min-width: 0; }
.cf-fpanel__title > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--uc-text-sm); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-fpanel__title > span { flex: none; font-size: var(--uc-text-xs); color: var(--uc-text-muted); }
.cf-fpanel__body { min-width: 0; }
.cf-fpanel .uich-ct-field-settings__tabs { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
.cf-fpanel .uich-ct-field-settings__tabs::-webkit-scrollbar { display: none; }
/* No focus ring on the field-settings tabs: the strip scrolls sideways, which clipped it to square
   stubs. Arrow keys select the tab they land on, so the active underline still shows where focus is. */
.cf-fpanel .uich-ct-field-settings__tabs [role="tab"]:focus-visible { outline: none; }

/* Type picker inside the pane. */
.cf-fpick { display: flex; flex-direction: column; gap: var(--uc-space-16); min-width: 0; padding: var(--uc-space-12) var(--uc-space-16) var(--uc-space-16); }
.cf-fpick__head { display: flex; align-items: center; gap: var(--uc-space-12); }
.cf-fpick__titles { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--uc-space-2); min-width: 0; }
.cf-fpick__titles > b { font-size: var(--uc-text-sm); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-fpick__titles > span { font-size: var(--uc-text-xs); color: var(--uc-text-muted); }
.cf-fpick .uich-ct-type-list { max-height: none; overflow: visible; padding-left: 0; }
.cf-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--uc-space-8); }

/* Where it shows, in the inspector: stacked rule blocks. */
.cf-cl { display: flex; flex-direction: column; gap: var(--uc-space-8); min-width: 0; }
.cf-rule { display: flex; flex-direction: column; gap: var(--uc-space-8); min-width: 0; padding: var(--uc-space-10); border: 1px solid var(--uc-border); border-radius: var(--uc-radius-8); background: var(--uc-surface-base); }
.cf-rule.is-invalid { border-color: var(--uc-danger-fg, var(--uc-danger)); }
.cf-rule-head { display: flex; align-items: center; gap: var(--uc-space-6); min-height: 20px; margin: calc(var(--uc-space-4) * -1) 0 0 calc(var(--uc-space-4) * -1); }
.cf-rule-idx { flex: 1 1 auto; font-size: var(--uc-text-2xs); font-weight: var(--uc-weight-medium); letter-spacing: var(--uc-tracking-wide); text-transform: uppercase; color: var(--uc-text-muted); }
.cf-rule-row { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: var(--uc-space-6); }
.cf-rule .cf-kit-select[class], .cf-rule-row > * { width: 100%; min-width: 0; }
.cf-cl-join { display: flex; align-items: center; gap: var(--uc-space-8); font-size: var(--uc-text-2xs); font-weight: var(--uc-weight-medium); letter-spacing: var(--uc-tracking-wide); color: var(--uc-text-muted); }
.cf-cl-join::before, .cf-cl-join::after { content: ""; flex: 1; height: 1px; background: var(--uc-border-subtle); }
.cf-cl-join span { padding: 1px var(--uc-space-6); border: 1px solid var(--uc-border); border-radius: var(--uc-radius-pill); background: var(--uc-surface-raised); }
.cf-cl-join--or span { text-transform: uppercase; color: var(--uc-text-strong); }
.cf-cl-and[class] { align-self: flex-start; margin: calc(var(--uc-space-4) * -1) calc(var(--uc-space-8) * -1) 0 0; }
.cf-cl-add[class] { align-self: flex-start; margin-top: var(--uc-space-4); }
.cf-cl .cf-pro-badge, .cf-rule-head > [class*="badge"] { flex: none; }

/* ── 10. Taxonomy: categories-or-tags choice, edit-screen box preview, post type chips ────── */
/* Choice cards on the DS RadioGroup (BoardUI's Radio card variant). */
.cf-choices[class] { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--uc-space-8); min-width: 0; }
.cf-choice { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: var(--uc-space-10); min-width: 0; padding: var(--uc-space-12); border-radius: var(--uc-radius-12); background: var(--uc-surface-raised); box-shadow: inset 0 0 0 1px var(--uc-border); cursor: pointer; transition: background var(--uc-dur-fast) var(--uc-ease-standard), box-shadow var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-choice:hover { background: var(--uc-surface-base); }
/* Picked = strong ring + lifted surface + inverted icon tile, so it reads at a glance and not only
   from the small radio dot. Neutral, not brand: the DS keeps brand for primary actions. */
.cf-choice.is-on { background: var(--uc-surface-raised); box-shadow: inset 0 0 0 1.5px var(--uc-text-strong); }
.cf-choice.is-on:hover { background: var(--uc-surface-raised); }
.cf-choice:has(:focus-visible) { box-shadow: inset 0 0 0 1px var(--uc-border-strong), 0 0 0 2px var(--uc-ring); }
.cf-choice.is-on:has(:focus-visible) { box-shadow: inset 0 0 0 1.5px var(--uc-text-strong), 0 0 0 2px var(--uc-ring); }
.cf-choice__icon { display: inline-grid; place-items: center; width: var(--uc-control-h-sm); height: var(--uc-control-h-sm); border-radius: var(--uc-radius-8); background: var(--uc-surface-base); color: var(--uc-text-strong); transition: background var(--uc-dur-fast) var(--uc-ease-standard), color var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-choice.is-on .cf-choice__icon { background: var(--uc-inverse-bg); color: var(--uc-inverse-fg); }
.cf-choice__text { display: flex; flex-direction: column; gap: var(--uc-space-2); min-width: 0; }
.cf-choice__title { font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); line-height: 1.35; color: var(--uc-text-strong); }
.cf-choice__desc { font-size: var(--uc-text-11); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); }

/* "How terms work": two DS Cards on a DS RadioGroup, each showing the box editors will get. */
.cf-termkind[class] { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--uc-space-12); min-width: 0; }
.cf-termkind__opt { min-width: 0; cursor: pointer; }
.cf-termkind__card[class] { height: 100%; box-shadow: inset 0 0 0 1px var(--uc-border); transition: box-shadow var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-termkind__opt:hover .cf-termkind__card { box-shadow: inset 0 0 0 1px var(--uc-border-strong); }
.cf-termkind__opt.is-on .cf-termkind__card { box-shadow: inset 0 0 0 1.5px var(--uc-text-strong); }
.cf-termkind__opt:has(:focus-visible) .cf-termkind__card { box-shadow: inset 0 0 0 1.5px var(--uc-text-strong), 0 0 0 2px var(--uc-ring); }
.cf-termkind__head[class] { gap: var(--uc-space-2); }
.cf-termkind__row { display: flex; align-items: center; gap: var(--uc-space-8); }
.cf-termkind__title[class] { margin: 0; font-size: var(--uc-text-sm); font-weight: var(--uc-weight-medium); }
.cf-termkind__desc[class] { margin: 0; padding-right: 24px; font-size: var(--uc-text-11); line-height: var(--uc-leading-snug); }
/* The preview: a small likeness of the edit-screen box, never interactive. */
.cf-termkind__box[class] { gap: var(--uc-space-6); margin: var(--uc-space-12); padding: var(--uc-space-10); border-radius: var(--uc-radius-8); background: var(--uc-surface-base); font-size: var(--uc-text-xs); color: var(--uc-text-strong); pointer-events: none; }
.cf-termkind__opt:not(.is-on) .cf-termkind__box { color: var(--uc-text-muted); }
.cf-termkind__boxhead { display: flex; align-items: center; justify-content: space-between; gap: var(--uc-space-8); padding-bottom: var(--uc-space-6); border-bottom: 1px solid var(--uc-border-subtle); font-weight: var(--uc-weight-medium); }
.cf-termkind__boxhead > svg { flex: none; color: var(--uc-text-muted); }
.cf-termkind__check { display: flex; align-items: center; gap: var(--uc-space-6); min-width: 0; }
.cf-termkind__check.is-child { padding-right: var(--uc-space-20); }
.cf-termkind__add { display: flex; gap: var(--uc-space-6); min-width: 0; }
.cf-termkind__add > :first-child { flex: 1 1 auto; min-width: 0; }
.cf-termkind__tags { display: flex; flex-wrap: wrap; gap: var(--uc-space-4); }

/* Used by: post type chips and a line on where the box will appear. */
/* DS Chips use the white control fill, made for a grey surface: give them one. */
.cf-usedby { display: flex; flex-wrap: wrap; gap: var(--uc-space-6); padding: var(--uc-space-8); border-radius: var(--uc-radius-8); background: var(--uc-surface-base); }
.cf-usedby__note[class] { margin: var(--uc-space-10) 0 0; font-size: var(--uc-text-xs); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); }
.cf-usedby__note.is-warn { color: var(--uc-warning-fg); }

/* ── 11. List rows and the New dialog ─────────────────────────────────────────────────────── */
.cf-name-sub { display: flex; align-items: center; min-width: 0; }
.cf-name-meta { flex: none; color: var(--uc-text-muted); }
.cf-name-meta::before { content: "\00b7"; margin: 0 var(--uc-space-6); color: var(--uc-text-subtle); }
.cf-name-meta.is-empty { color: var(--uc-text-subtle); }
.cf-status-filter[class] { flex: none; }
.cf-seg-count { margin-right: var(--uc-space-4); font-size: var(--uc-text-11); color: var(--uc-text-muted); font-variant-numeric: tabular-nums; }
/* New post type editor: "Start from" (TemplatePicker). Equal tiles, the picked one ringed with a
   check; the radio itself is visually hidden (still focusable), the tile is its label. Under the
   grid, one sentence on what the picked template adds, its fields as chips. */
.cf-tpl { display: flex; flex-direction: column; gap: var(--uc-space-12); min-width: 0; }
.cf-tpl__grid[class] { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: var(--uc-space-8); min-width: 0; }
.cf-tpl__tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: var(--uc-space-2); min-width: 0; padding: var(--uc-space-12); border-radius: var(--uc-radius-12); background: var(--uc-surface-raised); box-shadow: inset 0 0 0 1px var(--uc-border); cursor: pointer; transition: box-shadow var(--uc-dur-fast) var(--uc-ease-standard), background var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-tpl__tile:hover { box-shadow: inset 0 0 0 1px var(--uc-border-strong); }
.cf-tpl__tile.is-on { box-shadow: inset 0 0 0 1.5px var(--uc-text-strong); }
.cf-tpl__tile:has(:focus-visible) { box-shadow: inset 0 0 0 1px var(--uc-border-strong), 0 0 0 2px var(--uc-ring); }
.cf-tpl__tile.is-on:has(:focus-visible) { box-shadow: inset 0 0 0 1.5px var(--uc-text-strong), 0 0 0 2px var(--uc-ring); }
.cf-tpl__radio[class] { position: absolute; top: 0; right: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.cf-tpl__ico { display: inline-grid; place-items: center; width: 32px; height: 32px; margin-bottom: var(--uc-space-8); border-radius: var(--uc-radius-8); background: var(--uc-surface-base); color: var(--uc-text-strong); transition: background var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-tpl__tile:hover .cf-tpl__ico, .cf-tpl__tile.is-on .cf-tpl__ico { background: var(--uc-surface-sunken); }
.cf-tpl__check { position: absolute; top: var(--uc-space-10); left: var(--uc-space-10); display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: var(--uc-radius-pill); background: var(--uc-text-strong); color: var(--uc-surface-raised); opacity: 0; transform: scale(0.6); transition: opacity var(--uc-dur-fast) var(--uc-ease-standard), transform var(--uc-dur-fast) var(--uc-ease-standard); }
.cf-tpl__tile.is-on .cf-tpl__check { opacity: 1; transform: none; }
.cf-tpl__name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); line-height: 1.35; color: var(--uc-text-strong); }
.cf-tpl__meta { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--uc-text-11); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); }
.cf-tpl__sum { display: flex; align-items: center; flex-wrap: wrap; gap: var(--uc-space-6); min-width: 0; padding: var(--uc-space-10) var(--uc-space-12); border-radius: var(--uc-radius-12); background: var(--uc-surface-base); font-size: var(--uc-text-xs); line-height: 20px; color: var(--uc-text-muted); }
.cf-tpl__sum-ico { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--uc-radius-6); background: var(--uc-surface-raised); box-shadow: inset 0 0 0 1px var(--uc-border); color: var(--uc-text-strong); }
.cf-tpl__sum-name { font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-tpl__seg { display: inline-flex; align-items: center; flex-wrap: wrap; gap: var(--uc-space-4) var(--uc-space-6); min-width: 0; }
@media (prefers-reduced-motion: reduce) { .cf-tpl__tile, .cf-tpl__ico, .cf-tpl__check { transition: none; } }

/* Import preview: what's in the file, and whether each item is new or updates one on this site. */
.cf-imp[class] { display: flex; flex-direction: column; gap: var(--uc-space-12); }
.cf-imp__preview { display: flex; flex-direction: column; gap: var(--uc-space-8); min-width: 0; }
.cf-imp__sum[class] { display: flex; align-items: center; flex-wrap: wrap; gap: var(--uc-space-8); margin: 0; font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-imp__sum-parts { display: inline-flex; gap: var(--uc-space-6); }
.cf-imp__list[class] { max-height: 240px; overflow-y: auto; margin: 0; padding: 0; list-style: none; border-radius: var(--uc-radius-8); box-shadow: inset 0 0 0 1px var(--uc-border); }
.cf-imp__row[class] { display: flex; align-items: center; gap: var(--uc-space-10); margin: 0; padding: var(--uc-space-8) var(--uc-space-10); border-top: 1px solid var(--uc-border-subtle); }
.cf-imp__row:first-child { border-top: 0; }
.cf-imp__text { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--uc-space-2); min-width: 0; }
.cf-imp__text > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-imp__text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--uc-text-11); color: var(--uc-text-muted); }
.cf-imp__note[class] { margin: 0; font-size: var(--uc-text-11); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); }

/* ── 12. Migrate wizard: step rail beside the current step's card ─────────────────────────── */
.cf-mig { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--uc-space-16); align-items: start; min-width: 0; }
.cf-mig__rail { position: sticky; top: 64px; min-width: 0; }
.cf-mig__count[class] { display: none; margin: 0; font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); color: var(--uc-text-muted); }
.cf-mig__steps[class] { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.cf-mig__step[class] { position: relative; display: flex; gap: var(--uc-space-10); margin: 0; padding: 0 0 var(--uc-space-20); }
.cf-mig__step:not(:last-child)::before { content: ""; position: absolute; top: 26px; bottom: 4px; right: 10px; width: 1px; background: var(--uc-border); }
.cf-mig__step.is-done:not(:last-child)::before { background: var(--uc-text-strong); }
.cf-mig__step > .cf-step { flex: none; }
.cf-mig__step-text { display: flex; flex-direction: column; gap: var(--uc-space-2); min-width: 0; padding-top: 2px; }
.cf-mig__step-text > b { font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); color: var(--uc-text-muted); }
.cf-mig__step.is-current .cf-mig__step-text > b, .cf-mig__step.is-done .cf-mig__step-text > b { color: var(--uc-text-strong); }
.cf-mig__step-text > span { font-size: var(--uc-text-11); line-height: var(--uc-leading-snug); color: var(--uc-text-subtle); }
.cf-mig__step.is-current .cf-mig__step-text > span { color: var(--uc-text-muted); }
.cf-mig__card .cf-card__body[class] { display: flex; flex-direction: column; gap: var(--uc-space-12); }
.cf-mig__actions[class] { padding-top: var(--uc-space-12); border-top: 1px solid var(--uc-border-subtle); }
@media (max-width: 900px) {
	.cf-mig { grid-template-columns: minmax(0, 1fr); gap: var(--uc-space-8); }
	.cf-mig__rail { position: static; }
	.cf-mig__count[class] { display: block; }
	.cf-mig__steps[class] { display: none; }
}

/* Pro: the badge sits hard right on a type card; lock rows use DS text styles. */
.uich-ct-type-card .cf-type-pro { margin-right: auto; flex: none; }
.uich-gf-pro-lock-desc { margin: var(--uc-space-4) 0 0; font-size: var(--uc-text-xs); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); }

/* ── Empty state (EmptyState in ui/fields.jsx): one look for "nothing here" everywhere ──── */
.cf-es { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--uc-space-6); padding: var(--uc-space-32) var(--uc-space-16); min-width: 0; }
.cf-es--compact { padding: var(--uc-space-20) var(--uc-space-16); }
.cf-es__ico { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: var(--uc-space-4); border-radius: var(--uc-radius-12); background: var(--uc-surface-base); box-shadow: inset 0 0 0 1px var(--uc-border-subtle); color: var(--uc-text-strong); }
.cf-es__title { font-size: var(--uc-text-sm); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-es__text { max-width: 46ch; font-size: var(--uc-text-xs); line-height: var(--uc-leading-snug); color: var(--uc-text-muted); }
.cf-es__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--uc-space-8); margin-top: var(--uc-space-8); }
.cf-es--hero { padding: 0; }
.cf-es--hero .cf-es__title { font-size: var(--uc-text-md); }
.cf-es--hero .cf-es__text { max-width: 56ch; }

/* ── Migrate: DS parts in place of the old utility classes ──────────────────────────────── */
.cf-mig-stack { display: flex; flex-direction: column; gap: var(--uc-space-12); min-width: 0; }
.cf-mig-stack--tight { gap: var(--uc-space-6); }
.cf-mig-row { display: flex; align-items: center; gap: var(--uc-space-8); min-width: 0; }
.cf-mig-row--between { justify-content: space-between; }
.cf-mig-row--end { justify-content: flex-end; }
.cf-mig-row--wrap { flex-wrap: wrap; }
.cf-mig-loading { display: flex; align-items: center; justify-content: center; gap: var(--uc-space-8); padding: var(--uc-space-32) var(--uc-space-16); font-size: var(--uc-text-xs); color: var(--uc-text-muted); }
.cf-mig-label { font-size: var(--uc-text-xs); font-weight: var(--uc-weight-medium); color: var(--uc-text-strong); }
.cf-mig-muted { font-size: var(--uc-text-xs); color: var(--uc-text-muted); }
.cf-mig-num { font-variant-numeric: tabular-nums; }
.cf-mig-list { margin: 0; padding-inline-start: var(--uc-space-20); font-size: var(--uc-text-xs); line-height: var(--uc-leading-normal); color: var(--uc-text); }
.cf-mig-list > li { margin: var(--uc-space-2) 0; }
.cf-mig-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--uc-space-8); }
.cf-mig-stats--muted [role="group"] { opacity: .85; }
.cf-mig-box[class] { display: flex; flex-direction: column; gap: var(--uc-space-8); padding: var(--uc-space-14) var(--uc-space-16); overflow: visible; }
.cf-mig-box--flush[class] { gap: 0; padding: var(--uc-space-4) 0; }
.cf-mig-rename[class] { display: flex; width: -moz-fit-content; width: fit-content; margin-top: var(--uc-space-6); }
.cf-mig-progress { height: 8px; overflow: hidden; border-radius: var(--uc-radius-pill); background: var(--uc-surface-sunken); }
.cf-mig-progress__bar { height: 100%; border-radius: inherit; background: var(--uc-text-strong); transition: width var(--uc-dur-base) var(--uc-ease-standard); }
.cf-key-lock { display: block; color: var(--uc-text-muted); }

/* Editor that could not load its definition (missing id, server error). */
.cf-notfound { display: flex; flex-direction: column; align-items: flex-start; gap: var(--uc-space-8); max-width: 480px; padding: var(--uc-space-24); }
.cf-notfound__title { margin: 0; font-size: var(--uc-text-lg, 18px); }
.cf-notfound p { margin: 0; color: var(--uc-text-muted); }
.cf-notfound__actions { display: flex; gap: var(--uc-space-8); margin-top: var(--uc-space-8); }

