:root {
	/* Primary palette — deep olive / sage green */
	--color-primary:       hsl(100, 22%, 36%);
	--color-primary-dark:  hsl(100, 22%, 28%);
	--color-primary-light: hsl(100, 18%, 94%);

	/* Accent — warm terracotta */
	--color-accent:       hsl(16, 55%, 52%);
	--color-accent-dark:  hsl(16, 55%, 42%);
	--color-accent-light: hsl(16, 50%, 96%);

	/* Danger — red */
	--color-danger:       hsl(0, 60%, 50%);
	--color-danger-dark:  hsl(0, 60%, 40%);
	--color-danger-light: hsl(0, 55%, 96%);

	/* Success — green */
	--color-success:      hsl(140, 45%, 40%);

	/* Neutrals */
	--color-text:          hsl(30, 8%, 15%);
	--color-text-muted:    hsl(30, 4%, 46%);
	--color-bg:            hsl(40, 20%, 98%);
	--color-bg-band:       hsl(40, 18%, 94%);
	--color-bg-card:       hsl(0, 0%, 100%);
	--color-border:        hsl(30, 10%, 88%);
	--color-border-light:  hsl(30, 10%, 93%);
	--color-placeholder:   hsl(35, 12%, 92%);

	/* Shadows */
	--shadow-sm:  0 1px 2px hsla(30, 8%, 15%, 0.06);
	--shadow-md:  0 2px 8px hsla(30, 8%, 15%, 0.08);
	--shadow-lg:  0 4px 16px hsla(30, 8%, 15%, 0.1);

	/* Radii */
	--radius-sm:  4px;
	--radius-md:  8px;
	--radius-lg:  12px;
	--radius-pill: 9999px;

	/* Spacing */
	--space-xs:  0.25rem;
	--space-sm:  0.5rem;
	--space-md:  1rem;
	--space-lg:  1.5rem;
	--space-xl:  2rem;
	--space-2xl: 3rem;

	/* Typography */
	--font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
	--fine-print: .9em;

	/* Layout */
	--max-width: 1200px;
	--nav-height: 60px;
	--filter-width: 280px;

	/* Transitions */
	--transition-fast: 150ms ease;
	--transition-base: 200ms ease;
}

/* ── Reset & Base ── */

*,
*::before,
*::after {
	box-sizing: border-box;
	margin-top: 0;
}

[hidden] {
	display: none !important;
}

html {
	font-size: 18px;
	-webkit-text-size-adjust: 100%;
	tab-size: 2;
	overflow-x: hidden;
	&.no-scroll {
		overflow: hidden;
	}
}

body {
	font-family: var(--font-sans);
	line-height: 1.3;
	color: var(--color-text);
	background-color: var(--color-bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
svg {
	display: block;
	max-width: 100%;
}

input,
button,
textarea,
select {
	font: inherit;
	color: inherit;
}

a {
	color: var(--color-primary);
	text-decoration-skip-ink: auto;
	&:hover {
		color: var(--color-primary-dark);
	}
}

ol, ul {
	padding-left: 1.1em;
}

/* ── Typography ── */

h1, h2, h3, h4, h5, h6 {
	line-height: 1.1;
	font-weight: 600;
}

h1 {
	font-size: clamp(20px, 2vw + 12px, 28px);
	margin-bottom: var(--space-md);
}

h2 {
	font-size: 20px;
}

p + p {
	margin-top: var(--space-md);
}

/* ── Site Header & Navigation ── */

.site-header {
	background-color: var(--color-bg-card);
	border-bottom: 1px solid var(--color-border);
}

.site-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	max-width: var(--max-width);
	margin: 0 auto;
	padding: 0 var(--space-lg);
	height: var(--nav-height);
	.brand svg {
		display: block;
		height: 45px;
	}
	.links {
		display: flex;
		align-items: center;
		gap: var(--space-md);
		button {
			background: none;
			border: none;
			padding: 0;
			cursor: pointer;
			color: inherit;
			display: flex;
			align-items: center;
		}
	}
}

/* ── Main Content ── */

main {
	max-width: var(--max-width);
	margin: 0 auto;
	padding: var(--space-xl) var(--space-lg) 0;
}

/* ── Browse Layout ── */

.browse-layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-md);
	@media (min-width: 768px) {
		grid-template-columns: var(--filter-width) 1fr;
	}
}

/* ── Filter Toggle (small screens) ── */

.filter-toggle-bar {
	display: flex;
	justify-content: flex-end;
	gap: var(--space-sm);
	margin-top: -1em;
	margin-bottom: var(--space-md);
	@media (min-width: 768px) {
		margin-top: 0;
		#filter-toggle {
			display: none;
		}
		&:not(:has(#pin-toggle:not([hidden]))) {
			display: none;
		}
	}
}

#filter-toggle {
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
}

/* ── Filter Panel ── */

.filter-panel {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 100;
	background: var(--color-bg);
	padding: var(--space-md) var(--space-md) 0;
	overflow-y: auto;
	&.is-open {
		display: block;
	}
	.close {
		background: none;
		border: none;
		cursor: pointer;
		color: var(--color-text-muted);
		padding: 0;
		font-size: 2rem;
		line-height: 1;
		margin-left: var(--space-xs);
	}
	@media (min-width: 768px) {
		display: block;
		position: sticky;
		inset: unset;
		z-index: unset;
		top: var(--space-xl);
		height: calc(100vh - var(--space-xl) - 60px);
		animation: filter-panel-grow linear both;
		animation-timeline: scroll(root);
		animation-range: 0px 60px;
		overflow-y: auto;
		padding-top: 0;
		border-right: 1px solid var(--color-border-light);
		.close {
			display: none;
		}
	}
}

.filter-search {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	margin-bottom: var(--space-lg);
	input[type="search"] {
		display: block;
		width: 100%;
		padding: 0.5em 0.75em;
		color: var(--color-text);
		background-color: var(--color-bg-card);
		border: 1px solid var(--color-border);
		border-radius: var(--radius-md);
		transition: border-color var(--transition-fast),
		            box-shadow var(--transition-fast);
		&:focus {
			outline: none;
			border-color: var(--color-primary);
			box-shadow: 0 0 0 3px hsla(100, 22%, 36%, 0.15);
		}
		&::placeholder {
			color: var(--color-text-muted);
			opacity: 0.6;
		}
	}
}

.filter-section {
	border-bottom: 1px solid var(--color-border-light);
	&:last-of-type {
		border-bottom: none;
	}
	summary {
		padding: var(--space-sm) 0;
		font-weight: 600;
		text-transform: uppercase;
		color: var(--color-text-muted);
		cursor: pointer;
		user-select: none;
		list-style: none;
		&::-webkit-details-marker {
			display: none;
		}
	}
	&:has(input:checked) > summary::after {
		content: "\2022";
		margin-left: 0.3em;
		color: var(--color-primary);
	}
}

.filter-list {
	list-style: none;
	padding: 0;
	margin: 0 0 var(--space-sm) 0;
}

.filter-item {
	label {
		display: flex;
		align-items: center;
		gap: var(--space-sm);
		padding: var(--space-xs) 0;
		cursor: pointer;
		&:has(input:disabled) {
			opacity: 0.5;
			cursor: default;
		}
	}
	input[type="checkbox"],
	input[type="radio"] {
		position: absolute;
		opacity: 0;
		pointer-events: none;
		&:checked ~ .filter-name {
			font-weight: 700;
		}
	}
}

.filter-name {
	flex: 1;
	min-width: 0;
}

.filter-count {
	font-size: var(--fine-print);
	color: var(--color-text-muted);
	flex-shrink: 0;
}

.filter-clear-bar {
	position: sticky;
	bottom: 0;
	background: var(--color-bg);
	border-top: 1px solid var(--color-border);
	padding: var(--space-md) 0;
	margin-bottom: calc(-1 * var(--space-md));
	text-align: center;
}

.btn.filter-clear {
	display: inline-block;
	width: fit-content;
}

/* ── Recipe Grid ── */

.recipe-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-md);
	@media (min-width: 768px) {
		grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
		gap: var(--space-lg);
	}
}

/* ── Recipe Card ── */

.recipe-card {
	background: var(--color-bg-card);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	overflow: hidden;
	transition: box-shadow var(--transition-base), transform var(--transition-base);
	&:hover {
		box-shadow: var(--shadow-md);
		transform: translateY(-2px);
	}
	a {
		display: flex;
		text-decoration: none;
		color: inherit;
		@media (min-width: 768px) {
			display: block;
		}
	}
	.image {
		width: 100px;
		flex-shrink: 0;
		background-size: cover;
		background-position: center;
		@media (min-width: 768px) {
			width: 100%;
			aspect-ratio: 16 / 9;
		}
	}
	.placeholder {
		width: 100px;
		align-self: stretch;
		flex-shrink: 0;
		background-color: var(--color-placeholder);
		background-image:
			linear-gradient(
				135deg,
				var(--color-placeholder) 0%,
				hsl(35, 12%, 88%) 50%,
				var(--color-placeholder) 100%
			);
		@media (min-width: 768px) {
			width: 100%;
			aspect-ratio: 16 / 9;
			align-self: auto;
		}
	}
	.body {
		padding: var(--space-sm) var(--space-md);
	}
	h2 {
		font-size: 1rem;
		margin-bottom: var(--space-sm);
	}
	.meta {
		font-size: var(--fine-print);
		display: flex;
		align-items: center;
		gap: var(--space-sm);
		color: var(--color-text-muted);
		span + span::before {
			content: "\00b7";
			margin-right: var(--space-sm);
		}
	}
	.tags {
		display: flex;
		flex-wrap: wrap;
		gap: var(--space-xs);
		margin-top: var(--space-sm);
	}
}

/* ── Tags ── */

.tag {
	display: inline-block;
	padding: 0.15em 0.6em;
	font-weight: 500;
	color: var(--color-primary-dark);
	background-color: var(--color-primary-light);
	border-radius: var(--radius-pill);
	white-space: nowrap;
}

/* ── Empty State ── */

.empty-state {
	text-align: center;
	color: var(--color-text-muted);
	padding: var(--space-2xl) var(--space-lg);
}

/* ── Buttons ── */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-xs);
	padding: 0.55em 1.2em;
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background-color: var(--color-bg-card);
	color: var(--color-text);
	cursor: pointer;
	transition: background-color var(--transition-fast),
	            border-color var(--transition-fast),
	            box-shadow var(--transition-fast);
	white-space: nowrap;
	user-select: none;
	&:hover {
		background-color: var(--color-bg);
		border-color: var(--color-text-muted);
	}
	&:focus-visible {
		outline: 2px solid var(--color-primary);
		outline-offset: 2px;
	}
	&:disabled {
		opacity: 0.4;
		cursor: not-allowed;
	}
}

.btn-primary {
	background-color: var(--color-primary);
	border-color: var(--color-primary);
	color: #fff;
	&:hover {
		background-color: var(--color-primary-dark);
		border-color: var(--color-primary-dark);
		color: #fff;
	}
}

.btn-danger {
	background-color: var(--color-danger);
	border-color: var(--color-danger);
	color: #fff;
	&:hover {
		background-color: var(--color-danger-dark);
		border-color: var(--color-danger-dark);
		color: #fff;
	}
}

.btn-small {
	padding: 0.35em 0.85em;
}

/* ── Forms ── */

.form-group {
	margin-bottom: var(--space-lg);
	label {
		display: block;
		margin-bottom: var(--space-xs);
		font-weight: 500;
		color: var(--color-text);
	}
	input,
	textarea,
	select {
		display: block;
		width: 100%;
		padding: 0.5em 0.75em;
		color: var(--color-text);
		background-color: var(--color-bg-card);
		border: 1px solid var(--color-border);
		border-radius: var(--radius-md);
		transition: border-color var(--transition-fast),
		            box-shadow var(--transition-fast);
		&:focus {
			outline: none;
			border-color: var(--color-primary);
			box-shadow: 0 0 0 3px hsla(100, 22%, 36%, 0.15);
		}
		&::placeholder {
			color: var(--color-text-muted);
			opacity: 0.6;
		}
	}
	textarea {
		min-height: 6rem;
		resize: vertical;
	}
	select {
		appearance: none;
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8.825L.35 3.175 1.175 2.35 6 7.175 10.825 2.35l.825.825z'/%3E%3C/svg%3E");
		background-repeat: no-repeat;
		background-position: right 0.75em center;
		padding-right: 2.25em;
	}
}

/* ── SVG Sprites ── */

svg#sprites {
	visibility: hidden;
	height: 0;
	width: 0;
	position: absolute;
}

.icon {
	height: 1.5rem;
	width: auto;
	aspect-ratio: 1;
}

.icon-bg {
	fill: var(--color-primary);
}

.pin-btn {
	flex-shrink: 0;
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
	opacity: 0.35;
	&.is-pinned {
		opacity: 1;
	}
}

/* ── Utility ── */

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

/* ── Recipe Detail View ── */

.recipe-detail {
	max-width: 960px;
	margin: 0 auto;
	> header {
		margin-bottom: var(--space-xl);
	}
	.title-row {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		gap: var(--space-sm);
		margin-bottom: var(--space-sm);
		h1 {
			margin: 0 auto 0 0;
		}
		a {
			flex-shrink: 0;
		}
	}
	.share-btn {
		flex-shrink: 0;
		padding: 0;
		background: none;
		border: none;
		cursor: pointer;
	}
	.meta {
		font-size: var(--fine-print);
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		gap: var(--space-sm);
		color: var(--color-text-muted);
		margin-bottom: var(--space-lg);
		a {
			color: var(--color-primary);
			text-decoration: none;
			&:hover {
				color: var(--color-primary-dark);
				text-decoration: underline;
			}
		}
	}
	.meta-left,
	.meta-right {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: var(--space-sm);
		span + span::before {
			content: "\00b7";
			margin-right: var(--space-sm);
		}
	}
	> header img {
		width: 100%;
		aspect-ratio: 16 / 9;
		object-fit: cover;
		border-radius: var(--radius-lg);
		margin-bottom: var(--space-lg);
	}
	.body {
		display: grid;
		grid-template-columns: 1fr;
		gap: var(--space-xl);
		@media (min-width: 768px) {
			grid-template-columns: 1fr 1.5fr;
		}
	}
	.content {
		details {
			border-bottom: 1px solid var(--color-border-light);
			&:last-child {
				border-bottom: none;
			}
			&[open] summary {
				color: var(--color-primary-dark);
				&::after {
					content: "\2212";
				}
			}
		}
		summary {
			padding: var(--space-md) 0;
			font-weight: 600;
			cursor: pointer;
			user-select: none;
			list-style: none;
			display: flex;
			align-items: center;
			justify-content: space-between;
			&::-webkit-details-marker {
				display: none;
			}
			&::after {
				content: "+";
				font-weight: 400;
				color: var(--color-text-muted);
				transition: transform var(--transition-fast);
			}
		}
	}
	.tags {
		font-size: var(--fine-print);
		display: flex;
		flex-wrap: wrap;
		gap: var(--space-sm);
		margin-top: var(--space-xl);
		padding-top: var(--space-lg);
		border-top: 1px solid var(--color-border-light);
		.tag {
			text-decoration: none;
			&:hover {
				background-color: var(--color-primary);
				color: #fff;
			}
		}
	}
	.source {
		margin-top: var(--space-lg);
		a {
			color: var(--color-text-muted);
			text-decoration: none;
			word-break: break-all;
			&:hover {
				color: var(--color-primary);
				text-decoration: underline;
			}
		}
	}
}

/* ── Recipe Tabs (small screens) ── */

.recipe-tabs {
	display: flex;
	border-bottom: 2px solid var(--color-border);
	margin-bottom: var(--space-lg);
	@media (min-width: 768px) {
		display: none;
	}
	button {
		flex: 1;
		padding: var(--space-sm) var(--space-md);
		font-weight: 500;
		background: none;
		border: none;
		border-bottom: 2px solid transparent;
		margin-bottom: -2px;
		color: var(--color-text-muted);
		cursor: pointer;
		transition: color var(--transition-fast),
		            border-color var(--transition-fast);
		&:hover {
			color: var(--color-text);
		}
		&.active {
			color: var(--color-primary);
			border-bottom-color: var(--color-primary);
		}
	}
}

/* ── Tab Panels ── */

[role="tabpanel"][hidden] {
	display: none;
}

@media (min-width: 768px) {
	[role="tabpanel"],
	[role="tabpanel"][hidden] {
		display: block !important;
	}
}

/* ── Recipe Scale Slider ── */

.recipe-scale-label {
	font-weight: 600;
	color: var(--color-text-muted);
	margin-bottom: var(--space-xs);
}

.recipe-scale {
	display: block;
	width: 100%;
	margin: 0 0 var(--space-md) 0;
	accent-color: var(--color-primary);
}

/* ── Ingredient List ── */

.ingredient-list {
	list-style: none;
	padding: 0;
	margin: 0 0 var(--space-md) 0;
	display: grid;
	grid-template-columns: auto 1fr;
	li {
		display: contents;
		& > * {
			padding: var(--space-sm) 0;
			border-bottom: 1px solid var(--color-border-light);
		}
		&:last-child > * {
			border-bottom: none;
		}
		& > strong {
			padding-right: var(--space-sm);
			text-align: right;
		}
	}
}

.ingredient-group {
	font-weight: 600;
	text-transform: uppercase;
	color: var(--color-text-muted);
	margin-top: var(--space-lg);
	margin-bottom: var(--space-xs);
}

/* ── Markdown Prose ── */

.markdown {
	h1, h2, h3, h4, h5, h6 {
		font-size: 1rem;
	}
}

/* ── Recipe Form ── */

.form-band {
	margin-left: calc(-50vw + 50%);
	margin-right: calc(-50vw + 50%);
	padding-left: calc(50vw - 50%);
	padding-right: calc(50vw - 50%);
	padding-top: var(--space-xl);
	padding-bottom: var(--space-xl);
	&:first-child {
		padding-top: 0;
	}
	> h2 {
		display: flex;
		align-items: center;
		margin-bottom: var(--space-lg);
	}
	& > .form-group:last-child,
	& > .form-actions:last-child {
		margin-bottom: 0;
	}
}

.form-band-alt {
	background-color: var(--color-bg-band);
}

.page-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
}

.form-row {
	display: flex;
	gap: var(--space-lg);
	& > .form-group {
		flex: 1;
	}
	& > .form-group-grow {
		flex: 2;
	}
}

/* ── Ingredient Group Containers ── */

.ingredient-group-container {
	border: 1px solid var(--color-border-light);
	border-radius: var(--radius-md);
	padding: var(--space-md);
	margin-bottom: var(--space-md);
	background-color: var(--color-bg-card);
}

.ingredient-group-header {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	margin-bottom: var(--space-md);
}

.ingredient-group-label {
	flex: 1;
	padding: 0.3em 0;
	font-weight: 600;
	border: none;
	border-bottom: 1px solid var(--color-border-light);
	border-radius: 0;
	background: none;
	color: var(--color-text);
	&::placeholder {
		color: var(--color-text-muted);
		opacity: 0.5;
		font-weight: 400;
	}
	&:focus {
		outline: none;
		border-bottom-color: var(--color-primary);
	}
}

.ingredient-list-editor {
	list-style: none;
	padding: 0;
	margin: 0 0 var(--space-sm) 0;
	min-height: 2rem;
}

.ingredient-row {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	margin-bottom: var(--space-sm);
}

.ing-handle {
	cursor: grab;
	color: var(--color-text-muted);
	user-select: none;
	padding: 0 var(--space-xs);
	flex-shrink: 0;
	&:active {
		cursor: grabbing;
	}
}

.ing-amount {
	width: 120px;
	flex-shrink: 0;
	padding: 0.5em 0.75em;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background-color: var(--color-bg-card);
}

.ing-desc {
	flex: 1;
	padding: 0.5em 0.75em;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background-color: var(--color-bg-card);
}

.ing-amount,
.ing-desc {
	&:focus {
		outline: none;
		border-color: var(--color-primary);
		box-shadow: 0 0 0 3px hsla(100, 22%, 36%, 0.15);
	}
}

.ing-remove,
.group-up,
.group-down,
.group-remove {
	flex-shrink: 0;
	cursor: pointer;
}

/* ── SortableJS States ── */

.sortable-ghost {
	opacity: 0.3;
}

.sortable-chosen {
	background-color: var(--color-primary-light);
	border-radius: var(--radius-md);
}

.sortable-drag {
	background-color: var(--color-bg-card);
	box-shadow: var(--shadow-md);
	border-radius: var(--radius-md);
}

/* ── Taxonomy Buttons (recipe form) ── */

.taxonomy-buttons {
	margin-bottom: var(--space-lg);
	& > label {
		position: relative;
	}
	ul {
		display: flex;
		flex-wrap: wrap;
		gap: var(--space-xs);
		padding: 0;
		margin: 0;
		list-style: none;
		li {
			flex: 0 1 auto;
			white-space: nowrap;
			label {
				display: block;
				cursor: pointer;
			}
			span {
				display: block;
				padding: 0.25em 0.6em;
				border: 1px solid var(--color-border);
				border-radius: var(--radius-sm);
				background-color: var(--color-bg-card);
				font-weight: 500;
				user-select: none;
				transition:
					background-color var(--transition-fast),
					color var(--transition-fast),
					border-color var(--transition-fast)
				;
				&:hover {
					border-color: var(--color-primary);
				}
			}
			input {
				position: absolute;
				width: 1px;
				height: 1px;
				opacity: 0;
				z-index: -1;
				&:checked ~ span {
					background-color: var(--color-primary);
					border-color: var(--color-primary);
					color: #fff;
				}
				&:focus-visible ~ span {
					outline: 2px solid var(--color-primary);
					outline-offset: 2px;
				}
			}
		}
		+ ul {
			border-top: 1px solid hsl(0 0% 0% / .1);
			padding-top: .35rem;
		}
	}
}

/* ── Image Upload ── */

.image-replace-hint {
	color: var(--color-text-muted);
	margin-bottom: var(--space-xs);
}

.image-upload-area {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	border: 2px dashed var(--color-border);
	border-radius: var(--radius-md);
	cursor: pointer;
	overflow: hidden;
}

.image-upload-placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--color-text-muted);
}

.image-preview {
	width: 100%;
	height: 100%;
	object-fit: cover;
	&[src=""],
	&:not([src]) {
		display: none;
	}
}

.hint {
	font-weight: 400;
	color: var(--color-text-muted);
}

.hint-success {
	color: var(--color-success);
}

.form-actions-bar {
	position: sticky;
	bottom: 0;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: var(--space-md);
	padding: var(--space-md);
	.end {
		display: flex;
		gap: var(--space-md);
		margin-left: auto;
	}
}

/* ── Modal ── */

.modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 200;
	background-color: hsla(30, 8%, 15%, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
}

.modal {
	background-color: var(--color-bg-card);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-lg);
	padding: var(--space-xl);
	width: min(520px, 90vw);
	h3 {
		margin-bottom: var(--space-sm);
	}
	h4 {
		margin-top: var(--space-lg);
		margin-bottom: var(--space-sm);
	}
	textarea {
		display: block;
		width: 100%;
		padding: 0.5em 0.75em;
		color: var(--color-text);
		background-color: var(--color-bg-card);
		border: 1px solid var(--color-border);
		border-radius: var(--radius-md);
		resize: vertical;
		font-family: var(--font-sans);
		&:focus {
			outline: none;
			border-color: var(--color-primary);
			box-shadow: 0 0 0 3px hsla(100, 22%, 36%, 0.15);
		}
	}
}

.modal-intro {
	margin-bottom: var(--space-md);
	color: var(--color-text-muted);
}

.modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: var(--space-sm);
	margin-top: var(--space-md);
}

.modal-password {
	display: block;
	width: 100%;
	padding: 0.5em 0.75em;
	color: var(--color-text);
	background-color: var(--color-bg-card);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	font-family: var(--font-sans);
	&:focus {
		outline: none;
		border-color: var(--color-primary);
		box-shadow: 0 0 0 3px hsla(100, 22%, 36%, 0.15);
	}
}

.modal-error {
	margin-top: var(--space-sm);
	color: var(--color-danger, #c0392b);
}

/* ── Settings Page ── */

.settings-section {
	margin-bottom: var(--space-lg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background-color: var(--color-bg-card);
	> summary {
		display: flex;
		align-items: center;
		padding: var(--space-md) var(--space-lg);
		font-weight: 600;
		cursor: pointer;
		user-select: none;
		list-style: none;
		&::-webkit-details-marker {
			display: none;
		}
	}
}

.settings-form {
	padding: 0 var(--space-lg) var(--space-lg);
}

.settings-field {
	display: flex;
	gap: var(--space-sm);
	align-items: center;
	margin-top: var(--space-sm);
}

.settings-input {
	flex: 1;
	max-width: 400px;
	padding: var(--space-xs) var(--space-sm);
	font-family: monospace;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background-color: var(--color-bg);
	&:focus {
		outline: none;
		border-color: var(--color-accent);
		box-shadow: 0 0 0 1px var(--color-accent);
	}
}

.settings-reveal-btn {
	flex-shrink: 0;
}

/* ── Taxonomy Dashboard ── */

.taxonomy-section {
	margin-bottom: var(--space-md);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background-color: var(--color-bg-card);
	> summary {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: var(--space-md) var(--space-lg);
		font-weight: 600;
		cursor: pointer;
		user-select: none;
		list-style: none;
		&::-webkit-details-marker {
			display: none;
		}
	}
	.count {
		font-weight: 500;
		color: var(--color-text-muted);
		background-color: var(--color-bg);
		padding: 0.15em 0.6em;
		border-radius: var(--radius-pill);
	}
}

.dim-desc-row {
	padding: var(--space-sm) var(--space-lg);
}

.dim-desc-input {
	width: 100%;
	padding: 0.35em 0.6em;
	font-style: italic;
	color: var(--color-text-muted);
	background: transparent;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	transition: border-color var(--transition-fast),
	            background-color var(--transition-fast);
	&:hover {
		border-color: var(--color-border);
	}
	&:focus {
		outline: none;
		border-color: var(--color-primary);
		background-color: var(--color-bg-card);
		box-shadow: 0 0 0 2px hsla(100, 22%, 36%, 0.12);
		color: var(--color-text);
		font-style: normal;
	}
	&::placeholder {
		color: var(--color-text-muted);
		opacity: 0.5;
	}
}

.dim-desc-input-saved {
	background-color: hsla(100, 40%, 80%, 0.3);
}

.taxonomy-table {
	width: 100%;
	border-collapse: collapse;
	thead {
		border-top: 1px solid var(--color-border-light);
	}
	th {
		padding: var(--space-sm) var(--space-md);
		text-align: left;
		font-weight: 600;
		text-transform: uppercase;
		color: var(--color-text-muted);
		border-bottom: 1px solid var(--color-border-light);
		&.col-name {
			padding-left: calc(var(--space-xs) + 0.7rem + var(--space-xs) + 0.5em);
		}
	}
	td {
		padding: var(--space-xs) var(--space-md);
		border-bottom: 1px solid var(--color-border-light);
		vertical-align: middle;
		&.col-name .inner {
			display: flex;
			align-items: center;
			gap: var(--space-xs);
			.taxonomy-name-input {
				flex: 1;
				min-width: 0;
				&:first-child {
					margin-left: calc(1.7rem + var(--space-xs));
				}
			}
		}
	}
	tfoot td {
		padding: var(--space-sm) var(--space-md);
		border-bottom: none;
	}
	.col-name {
		width: 25%;
		padding-left: var(--space-xs);
	}
	.col-desc {
		width: auto;
	}
	.col-count {
		width: 5em;
		text-align: center;
		color: var(--color-text-muted);
	}
	.col-actions {
		width: 3em;
		text-align: center;
		padding-inline: var(--space-xs);
	}
}

.taxonomy-inline-input {
	width: 100%;
	padding: 0.3em 0.5em;
	color: var(--color-text);
	background: transparent;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	transition: border-color var(--transition-fast),
	            background-color var(--transition-fast);
	&:hover {
		border-color: var(--color-border);
	}
	&:focus {
		outline: none;
		border-color: var(--color-primary);
		background-color: var(--color-bg-card);
		box-shadow: 0 0 0 2px hsla(100, 22%, 36%, 0.12);
	}
	&::placeholder {
		color: var(--color-text-muted);
		opacity: 0.5;
	}
}

.taxonomy-inline-input-dirty {
	border-color: var(--color-accent);
	box-shadow: 0 0 0 1px var(--color-accent);
}

.taxonomy-inline-input-saved {
	background-color: hsla(100, 40%, 80%, 0.3);
}

.taxonomy-row-child {
	td:first-child {
		padding-left: var(--space-xl);
	}
	.taxonomy-name-input {
		color: var(--color-text-muted);
	}
}

.taxonomy-parent-select {
	width: 100%;
	padding: 0.2em;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background-color: var(--color-bg-card);
}

/* ── Cuisine Hierarchy ── */

.filter-list-children {
	display: none;
	padding-left: 0;
}

.filter-item:has(> label > input:checked) > .filter-list-children,
.filter-item:has(.filter-item-child > label > input:checked) > .filter-list-children {
	display: block;
}

.filter-item-child .filter-name::before {
	content: "\2514\00a0";
	color: var(--color-text-muted);
	opacity: 0.5;
}

.taxonomy-subcuisines:not(:has(li:not([hidden]))) {
	display: none;
}

/* ── Taxonomy Action Icons ── */

.taxonomy-delete-btn,
.taxonomy-add-btn,
.taxonomy-promote-btn {
	flex-shrink: 0;
	cursor: pointer;
}

.taxonomy-promote-btn {
	margin-left: calc(0.7rem + var(--space-xs));
}

.taxonomy-demote-wrap {
	flex-shrink: 0;
	position: relative;
	display: inline-block;
	.taxonomy-parent-select {
		position: absolute;
		inset: 0;
		opacity: 0;
		cursor: pointer;
	}
}

/* ── Dimension Info Tooltip ── */

.dim-info-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-left: 0.25em;
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
	vertical-align: middle;
	.icon {
		height: 1rem;
		width: auto;
		opacity: 0.4;
		transition: opacity var(--transition-fast);
	}
	&:hover .icon {
		opacity: 0.7;
	}
}

.dim-info-tip {
	display: none;
	position: absolute;
	z-index: 10;
	top: calc(100% + 4px);
	left: 0;
	max-width: 300px;
	padding: 0.5em 0.75em;
	font-weight: 400;
	font-style: italic;
	color: var(--color-text-muted);
	background-color: var(--color-bg-card);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-md);
	white-space: normal;
	&[aria-expanded="true"] {
		display: block;
	}
}

/* ── AI Features ── */

#paste-recipe-btn,
#suggest-tags-btn {
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
}

#suggest-tags-btn {
	margin-left: auto;
}

.ai-suggested {
	background-color: var(--color-accent-light);
	border-radius: var(--radius-sm);
	animation: ai-pulse 0.6s ease-out;
}

@keyframes filter-panel-grow {
	from { height: calc(100vh - var(--space-xl) - 60px); }
	to   { height: calc(100vh - var(--space-xl)); }
}

@keyframes ai-pulse {
	0%   { box-shadow: 0 0 0 0 hsla(16, 55%, 52%, 0.4); }
	70%  { box-shadow: 0 0 0 6px hsla(16, 55%, 52%, 0); }
	100% { box-shadow: 0 0 0 0 hsla(16, 55%, 52%, 0); }
}

/* ── Load More ── */

.load-more {
	margin-top: var(--space-lg);
	text-align: center;
}

/* ── Version indicator ── */

.app-version {
	font-size: var(--fine-print);
	text-align: right;
	color: var(--color-text-muted);
	opacity: 0.4;
	padding: var(--space-sm) var(--space-md);
}

/* ── Login page ──────────────────────────────────────────────── */

.login-wrap {
	display: flex;
	min-height: 100vh;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.login-card {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	width: 100%;
	max-width: 20rem;
	text-align: center;
}

.login-input {
	width: 100%;
	box-sizing: border-box;
}

.login-error {
	color: #c0392b;
	margin: 0;
}
