:root {
	/*
	 * Brand: warm paper background + green accent, translated to Tabler
	 * CSS variables so buttons, badges and tints pick up the colour.
	 */
	--tblr-primary: #3a9d5d;
	--tblr-primary-rgb: 58, 157, 93;
	--tblr-primary-darken: #267346;
	--tblr-primary-lt: #e7f3eb;
	--tblr-bg-surface-secondary: #faf9f5;
}

body {
	background: #faf9f5;
	color: #202522;
	min-height: 100vh;
}

a {
	color: #267346;
}

a:hover {
	color: #3a9d5d;
}

/*
 * Overview page: shopping list cards.
 */
.list-card {
	border: 1px solid var(--tblr-border-color);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	height: 100%;
}

.list-card:hover {
	border-color: var(--tblr-primary);
	box-shadow: 0 4px 14px rgba(38, 115, 70, 0.12);
}

.list-card-label {
	color: #202522;
	font-weight: 600;
}

/*
 * Detail page: swipe-to-delete rows and drag ordering.
 */
.item-list {
	list-style: none;
	padding-left: 0;
	margin-bottom: 0;
}

.swipe-row {
	position: relative;
	overflow: hidden;
	padding: 0;
}

.swipe-backdrop {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 88px;
	display: flex;
	align-items: stretch;
}

.swipe-delete {
	background: var(--tblr-danger);
	border: 0;
	color: #fff;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	padding: 0;
}

.swipe-delete:active {
	background: #c04e4e;
}

.swipe-delete-label {
	font-size: 0.68rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.swipe-content {
	position: relative;
	transition: transform 0.25s ease;
	will-change: transform;
	padding: 0.55rem 1rem;
}

.swipe-content.swipe-open {
	transform: translateX(-88px);
}

.item-row > .swipe-content {
	background: #ffffff;
}

.item-row-bought > .swipe-content {
	background: var(--tblr-primary-lt);
}

.item-toggle {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	padding: 0;
	flex-shrink: 0;
}

.item-body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.item-label {
	font-size: 1.02rem;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	padding: 4px 0;
	cursor: pointer;
}

.item-meta {
	font-size: 0.8rem;
	color: var(--tblr-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/*
 * Offline queue: a pending row is visually marked until the server confirmed
 * the bought state.
 */
.item-pending > .swipe-content {
	outline: 1px dashed var(--tblr-muted);
	outline-offset: -2px;
}

.item-pending-icon {
	color: var(--tblr-muted);
	flex-shrink: 0;
}

#offline-banner {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1080;
	margin: 0;
	border-radius: 0;
	padding: 0.5rem 1rem;
	padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
	font-size: 0.875rem;
}

@media (min-width: 768px) {
	#offline-banner {
		left: 50%;
		right: auto;
		bottom: 1rem;
		width: auto;
		max-width: 640px;
		transform: translateX(-50%);
		border-radius: var(--tblr-border-radius);
	}
}

@media (max-width: 575.98px) {
	.item-toggle {
		width: 28px;
		height: 28px;
		font-size: 0.75rem;
		line-height: 1;
	}

	.swipe-content {
		padding: 0.4rem 0.75rem;
	}

	.item-row .d-flex,
	.item-row-bought .d-flex {
		gap: 0.65rem;
	}

	.item-label {
		font-size: 0.95rem;
	}
}

/*
 * Detail page: item pictures.
 */
.item-image-thumb {
	width: 40px;
	height: 40px;
	object-fit: cover;
	border-radius: 6px;
	border: 1px solid var(--tblr-border-color);
}

.item-image-thumb-lg {
	max-width: 100%;
	height: 180px;
	object-fit: cover;
	border-radius: 10px;
	border: 1px solid var(--tblr-border-color);
}

.detail-title {
	font-size: 1.6rem;
	font-weight: 700;
}

@media (min-width: 768px) {
	.sticky-add {
		max-width: 640px;
	}
}

/*
 * Add-item autocomplete: a native input with our own suggestion list.
 *
 * The 16px font is deliberate: iOS zooms the page when a focused field is
 * smaller than that, which pushed the field (and the list) out of view.
 */
.add-item-field {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
}

.add-item-button {
	flex: 0 0 auto;
	min-height: 44px;
}

#item-search {
	font-size: 1rem;
	min-height: 44px;
	touch-action: manipulation;
}

.item-suggestions {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 4px);
	z-index: 1050;
	max-height: 240px;
	overflow-y: auto;
	background-color: var(--tblr-bg-forms, #fff);
	border: var(--tblr-border-width, 1px) solid var(--tblr-border-color);
	border-radius: var(--tblr-border-radius);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.item-suggestion {
	display: block;
	width: 100%;
	padding: 10px 12px;
	min-height: 44px;
	border: 0;
	background: none;
	color: var(--tblr-body-color, #1f2937);
	font-size: 1rem;
	line-height: 1.25;
	text-align: left;
	touch-action: manipulation;
	-webkit-tap-highlight-color: rgba(0, 0, 0, 0.06);
}

.item-suggestion.is-highlighted {
	background-color: var(--tblr-primary);
	color: #fff;
}