/* Dusk control recipes for the plan editor panels.
   Source design system: dusk/ at the repository root (tokens/dusk.css); the panel
   artboards live in the Paper file "Cordelia Works — Design System".

   The two vocabularies never converge:
     inputs are white with borders; buttons are filled without borders.
   Radii (ratified 2026-08-17): 4px controls/chips/containers, 3px nested
   elements (checkboxes, segments inside tracks, badges), pill only for
   switches and radios.

   Ink ramp on paper: full ink #0A0A0A; 62% secondary text; 45% apparatus
   labels; 38% metadata; 24% input borders; 14% hairlines; 12% internal
   separators; 7% button fill; 5% washes; 3% hover wash. */

.dk {
	--dk-ink: #0a0a0a;
	--dk-paper: #ffffff;
	--dk-ink-dim: rgb(10 10 10 / 62%);
	--dk-ink-45: rgb(10 10 10 / 45%);
	--dk-ink-faint: rgb(10 10 10 / 38%);
	--dk-border-input: rgb(10 10 10 / 24%);
	--dk-rule: rgb(10 10 10 / 14%);
	--dk-sep: rgb(10 10 10 / 12%);
	--dk-fill-btn: rgb(10 10 10 / 7%);
	--dk-wash: rgb(10 10 10 / 5%);
	--dk-wash-hover: rgb(10 10 10 / 3%);
	--dk-destructive: #b42318;
	--dk-r-md: 4px;
	--dk-r-sm: 3px;
	font-family: var(--ce-font-sans, "Archivo", system-ui, sans-serif);
	color: var(--dk-ink);
}

/* ---- Apparatus ---------------------------------------------------------- */
.dk-label {
	font-size: 10px;
	font-weight: 600;
	font-stretch: 62%;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--dk-ink-45);
}

.dk-row {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 28px;
}

.dk-row-label {
	font-size: 13px;
	font-weight: 500;
	color: var(--dk-ink);
}

.dk-meta {
	font-size: 11px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	color: var(--dk-ink-dim);
}

.dk-hairline {
	border: none;
	border-top: 1px solid var(--dk-rule);
	margin: 0;
}

/* ---- Inputs: white with borders ----------------------------------------- */
.dk-input {
	height: 28px;
	padding: 0 8px;
	background: var(--dk-paper);
	border: 1px solid var(--dk-border-input);
	border-radius: var(--dk-r-md);
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 500;
	font-variant-numeric: tabular-nums slashed-zero;
	color: var(--dk-ink);
	text-align: right;
}
.dk-input:focus-visible {
	outline: none;
	border-color: var(--dk-ink);
	box-shadow: 0 0 0 2px rgb(10 10 10 / 10%);
}
.dk-input::placeholder {
	color: var(--dk-ink-faint);
	font-variant-numeric: normal;
}

.dk-select {
	height: 28px;
	padding: 0 26px 0 10px;
	background: var(--dk-paper);
	border: 1px solid var(--dk-border-input);
	border-radius: var(--dk-r-md);
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	color: var(--dk-ink);
	appearance: none;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%230A0A0A' stroke-opacity='0.55' stroke-width='1.4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 9px center;
}
.dk-select:focus-visible {
	outline: none;
	border-color: var(--dk-ink);
	box-shadow: 0 0 0 2px rgb(10 10 10 / 10%);
}

/* ---- Buttons: filled without borders ------------------------------------ */
.dk-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 28px;
	padding: 0 12px;
	background: var(--dk-fill-btn);
	border: none;
	border-radius: var(--dk-r-md);
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 500;
	color: var(--dk-ink);
	cursor: pointer;
}
.dk-btn:hover:not(:disabled) {
	background: rgb(10 10 10 / 11%);
}
.dk-btn:disabled {
	background: rgb(10 10 10 / 4%);
	color: rgb(10 10 10 / 35%);
	cursor: default;
}
.dk-btn-primary {
	background: var(--dk-ink);
	color: var(--dk-paper);
}
.dk-btn-primary:hover:not(:disabled) {
	background: rgb(10 10 10 / 80%);
}
.dk-btn-danger {
	background: none;
	color: var(--dk-destructive);
	padding: 0 4px;
}
.dk-btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px rgb(10 10 10 / 25%);
}

/* Disabled buttons state their reason in an adjacent .dk-reason line. */
.dk-reason {
	font-size: 11px;
	font-weight: 400;
	color: var(--dk-ink-45);
}

/* ---- Checkbox: a row in a list ------------------------------------------ */
.dk-check {
	appearance: none;
	width: 14px;
	height: 14px;
	margin: 0;
	flex-shrink: 0;
	border: 1.5px solid rgb(10 10 10 / 30%);
	border-radius: var(--dk-r-sm);
	background: var(--dk-paper);
	cursor: pointer;
	display: inline-grid;
	place-content: center;
}
.dk-check:checked {
	background: var(--dk-ink);
	border-color: var(--dk-ink);
}
.dk-check:checked::before {
	content: "";
	width: 8px;
	height: 8px;
	background: var(--dk-paper);
	clip-path: polygon(12% 52%, 38% 78%, 88% 20%, 76% 10%, 38% 56%, 24% 42%);
}
.dk-check:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px rgb(10 10 10 / 20%);
}
.dk-check-sm {
	width: 12px;
	height: 12px;
}

/* ---- Stepper: one composed instrument, [− | value | +] ------------------- */
.dk-stepper {
	display: inline-flex;
	align-items: stretch;
	height: 28px;
	background: var(--dk-paper);
	border: 1px solid rgb(10 10 10 / 20%);
	border-radius: var(--dk-r-md);
	overflow: hidden;
}
.dk-stepper > button {
	width: 26px;
	border: none;
	background: none;
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	color: var(--dk-ink);
	cursor: pointer;
	padding: 0;
}
.dk-stepper > button:first-child {
	border-right: 1px solid var(--dk-sep);
}
.dk-stepper > button:last-child {
	border-left: 1px solid var(--dk-sep);
}
.dk-stepper > button:hover {
	background: var(--dk-wash);
}
.dk-stepper > input,
.dk-stepper > span {
	width: 58px;
	border: none;
	background: none;
	text-align: center;
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 500;
	font-variant-numeric: tabular-nums slashed-zero;
	color: var(--dk-ink);
	align-self: center;
	padding: 0;
}
.dk-stepper > input:focus-visible {
	outline: none;
}
.dk-stepper:focus-within {
	border-color: var(--dk-ink);
}

/* ---- Segmented: exhaustive exclusive states ------------------------------ */
.dk-segmented {
	display: inline-flex;
	align-items: stretch;
	height: 28px;
	padding: 2px;
	gap: 2px;
	background: var(--dk-fill-btn);
	border-radius: var(--dk-r-md);
}
.dk-segmented > button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	padding: 0 10px;
	border: none;
	border-radius: var(--dk-r-sm);
	background: none;
	font-family: inherit;
	font-size: 12px;
	font-weight: 500;
	color: var(--dk-ink-dim);
	cursor: pointer;
}
.dk-segmented > button[aria-pressed="true"],
.dk-segmented > button.dk-active {
	background: var(--dk-paper);
	border: 1px solid rgb(10 10 10 / 20%);
	color: var(--dk-ink);
	font-weight: 600;
}

/* ---- Quick-set chips: presets over a continuous value -------------------- */
.dk-chip {
	display: inline-flex;
	align-items: center;
	height: 22px;
	padding: 0 10px;
	background: var(--dk-fill-btn);
	border: none;
	border-radius: var(--dk-r-md);
	font-family: inherit;
	font-size: 11px;
	font-weight: 500;
	color: var(--dk-ink);
	cursor: pointer;
}
.dk-chip.dk-active {
	background: var(--dk-ink);
	color: var(--dk-paper);
}

/* ---- Id chip: mono, click copies ---------------------------------------- */
.dk-id {
	display: inline-flex;
	align-items: center;
	height: 22px;
	padding: 0 8px;
	background: var(--dk-paper);
	border: 1px solid var(--dk-rule);
	border-radius: var(--dk-r-md);
	font-family: var(--ce-font-mono, "Chivo Mono", ui-monospace, monospace);
	font-size: 11px;
	color: var(--dk-ink);
	cursor: copy;
}

/* ---- Row furniture ------------------------------------------------------- */
.dk-handle {
	border: none;
	background: none;
	padding: 0;
	width: 16px;
	text-align: center;
	font-size: 13px;
	color: rgb(10 10 10 / 35%);
	cursor: grab;
}
.dk-x {
	border: none;
	background: none;
	padding: 0;
	width: 16px;
	text-align: center;
	font-size: 12px;
	color: rgb(10 10 10 / 35%);
	cursor: pointer;
}
.dk-x:hover {
	color: var(--dk-ink);
}

/* ---- Range: hairline track, ink thumb ------------------------------------ */
.dk-slider {
	appearance: none;
	height: 12px;
	background: none;
	cursor: pointer;
}
.dk-slider::-webkit-slider-runnable-track {
	height: 1.5px;
	background: rgb(10 10 10 / 20%);
}
.dk-slider::-webkit-slider-thumb {
	appearance: none;
	width: 10px;
	height: 10px;
	margin-top: -4.25px;
	border-radius: 999px;
	background: var(--dk-ink);
	border: none;
}

/* ---- Readout: an uneditable tabular fact --------------------------------- */
.dk-readout {
	font-size: 12.5px;
	font-weight: 500;
	font-variant-numeric: tabular-nums slashed-zero;
	color: var(--dk-ink);
}

/* ---- Popover (tokens in dusk/tokens/dusk.css; DimSum's shadcn popovers and
   menus read the same tokens through .dusk-popover / .dusk-menu in its app.css).
   A popover sizes to its content, never to a set width, up to the screen less
   two gutters; its body scrolls when it would run off the screen. The fallbacks
   keep a standalone editor (no Dusk tokens loaded) on the same values. ------ */
.dk-popover {
	max-width: calc(100vw - 2 * var(--popover-gutter, 12px));
	border: 1px solid var(--popover-rule, var(--dk-rule));
	border-radius: var(--popover-radius, var(--dk-r-md));
	background: var(--popover-surface, var(--dk-paper));
	box-shadow: var(--popover-shadow, 0 12px 28px rgb(10 10 10 / 16%));
	color: var(--dk-ink);
	/* The one popover layer: above the plan's own overlays in the editor root. */
	z-index: 50;
	display: flex;
	flex-direction: column;
	width: max-content;
	max-height: calc(var(--bits-popover-content-available-height, 100vh) - var(--popover-gutter, 12px));
	outline: none;
}
.dk-popover-head {
	display: flex;
	align-items: baseline;
	gap: 8px;
	padding: var(--popover-pad, 12px) var(--popover-pad, 12px) 0;
}
.dk-popover-title {
	font-size: 12px;
	font-weight: 600;
	line-height: 16px;
	color: var(--dk-ink);
}
.dk-popover-meta {
	font-size: 12px;
	line-height: 16px;
	color: var(--dk-ink-dim);
}
.dk-popover-close {
	align-self: center;
	width: 22px;
	height: 22px;
	margin-left: auto;
	padding: 0;
	border: none;
	border-radius: var(--dk-r-sm);
	background: none;
	color: var(--dk-ink-dim);
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
}
.dk-popover-close:hover {
	background: var(--dk-wash);
	color: var(--dk-ink);
}
.dk-popover-body {
	min-height: 0;
	overflow: auto;
	padding: var(--popover-pad, 12px);
}
