.sp-root {
	--sp-ink: #2b2620;
	--sp-muted: #8a8377;
	--sp-bg: #f8f6f2;
	--sp-surface: #ffffff;
	--sp-border: #e8e3da;
	--sp-accent: #d97706;
	--sp-accent-soft: #fdf2e3;
	--sp-radius: 12px;
	--sp-shadow: 0 1px 2px rgba(24, 20, 12, 0.05);
	--sp-shadow-lift: 0 6px 16px rgba(24, 20, 12, 0.10);
	font-size: 15px;
	line-height: 1.45;
	color: var(--sp-ink);
	max-width: 1320px;
	margin: 0 auto;
	padding: 4px;
}

/* ---- Hard reset: keep theme button/input styles out of the app ---- */
.sp-root button {
	appearance: none;
	-webkit-appearance: none;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	margin: 0;
	padding: 0;
	color: inherit;
	font: inherit;
	font-weight: 500;
	text-transform: none;
	letter-spacing: normal;
	line-height: 1.3;
	cursor: pointer;
	transition: all 0.15s ease;
}
.sp-root button:hover,
.sp-root button:focus {
	background: transparent;
	color: inherit;
	box-shadow: none;
}
.sp-root button:focus-visible {
	outline: 2px solid var(--sp-accent);
	outline-offset: 2px;
}
.sp-root h3,
.sp-root p,
.sp-root label {
	margin: 0;
	color: inherit;
}
.sp-root svg {
	display: block;
	flex: 0 0 auto;
	width: 1em;
	height: 1em;
}

/* ---------------------------------- steps ---------------------------------- */
.sp-steps {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 14px;
}
.sp-root .sp-step {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--sp-surface);
	border: 1px solid var(--sp-border);
	border-radius: 999px !important;
	padding: 8px 18px 8px 8px;
	font-size: 14px;
	line-height: 1.3 !important;
	color: var(--sp-muted);
	box-shadow: var(--sp-shadow);
}
.sp-root .sp-step:hover {
	border-color: var(--sp-accent);
	color: var(--sp-ink);
	background: var(--sp-surface);
}
.sp-step-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	min-width: 26px;
	border-radius: 50% !important;
	background: var(--sp-bg);
	border: 1px solid var(--sp-border);
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1 !important;
	padding-top: 4px;
	color: var(--sp-muted);
}
.sp-step-name { margin-top: 5px; }
.sp-step-icon { font-size: 16px; display: inline-flex; align-items: center; }
.sp-root .sp-step.is-active {
	background: var(--sp-ink);
	border-color: var(--sp-ink);
	color: #fff;
	box-shadow: var(--sp-shadow-lift);
}
.sp-root .sp-step.is-active:hover { background: var(--sp-ink); color: #fff; }
.sp-root .sp-step.is-active .sp-step-num {
	background: var(--sp-accent);
	border-color: var(--sp-accent);
	color: #fff;
}

/* ---------------------------------- layout ---------------------------------- */
.sp-main {
	display: flex;
	gap: 16px;
	align-items: stretch;
}

.sp-sidebar {
	flex: 0 0 318px;
	border: 1px solid var(--sp-border);
	border-radius: var(--sp-radius);
	padding: 18px;
	background: var(--sp-surface);
	box-shadow: var(--sp-shadow);
	overflow-y: auto;
	max-height: 74vh;
}
.sp-sidebar h3 {
	font-size: 16.5px;
	font-weight: 700;
	margin-bottom: 4px;
}
.sp-micro {
	font-size: 12.5px;
	color: var(--sp-muted);
	margin: 2px 0 14px;
}
.sp-sidebar label {
	display: block;
	margin: 12px 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--sp-ink);
}
.sp-root .sp-sidebar input[type="number"],
.sp-root .sp-sidebar input[type="email"] {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 9px 11px !important;
	background: var(--sp-surface) !important;
	border: 1px solid var(--sp-border) !important;
	border-radius: 8px !important;
	margin-top: 5px;
	font: inherit;
	font-weight: 400;
	line-height: 1.4 !important;
	color: var(--sp-ink);
	box-shadow: none;
}
.sp-root .sp-sidebar input:focus {
	outline: none;
	border-color: var(--sp-accent);
	box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.sp-root .sp-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	background: var(--sp-accent);
	color: #fff;
	border-radius: 9px;
	padding: 11px 14px;
	font-size: 14px;
	font-weight: 600;
	margin-top: 10px;
	box-shadow: var(--sp-shadow);
}
.sp-root .sp-btn:hover {
	background: #b45309;
	color: #fff;
	box-shadow: var(--sp-shadow-lift);
}
.sp-root .sp-btn:disabled {
	opacity: 0.55;
	cursor: default;
	box-shadow: none;
}
.sp-root .sp-btn:disabled:hover {
	background: var(--sp-accent);
	box-shadow: none;
}
.sp-root .sp-btn-ghost {
	background: transparent;
	color: var(--sp-muted);
	border: 1px solid var(--sp-border);
	box-shadow: none;
	font-weight: 500;
}
.sp-root .sp-btn-ghost:hover {
	background: var(--sp-bg);
	color: var(--sp-ink);
	border-color: var(--sp-border);
	box-shadow: none;
}

/* ------------------------------- catalog tree ------------------------------- */
.sp-sidebar details {
	border-top: 1px solid var(--sp-border);
	padding: 0 !important;
}
.sp-sidebar details:first-of-type { border-top: 0; }
.sp-sidebar summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	font-weight: 600;
	font-size: 13.5px;
	padding: 9px 2px;
	border-radius: 6px;
	list-style: none;
	user-select: none;
}
.sp-sidebar summary::-webkit-details-marker { display: none; }
.sp-sidebar summary::after {
	content: "";
	width: 7px;
	height: 7px;
	border-right: 1.8px solid var(--sp-muted);
	border-bottom: 1.8px solid var(--sp-muted);
	transform: rotate(-45deg);
	transition: transform 0.15s ease;
	margin-right: 4px;
}
.sp-sidebar details[open] > summary::after { transform: rotate(45deg); }
.sp-sidebar summary:hover { color: var(--sp-accent); }
.sp-subcat { margin-left: 0 !important; border-top: 0 !important; }
.sp-subcat summary { font-weight: 500; font-size: 13px; color: #57514a; }

.sp-root .sp-search {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 9px 12px !important;
	background: var(--sp-bg) !important;
	border: 1px solid var(--sp-border) !important;
	border-radius: 8px !important;
	font: inherit;
	font-size: 13.5px;
	line-height: 1.4 !important;
	color: var(--sp-ink);
	margin-bottom: 10px;
}
.sp-root .sp-search:focus {
	outline: none;
	background: var(--sp-surface);
	border-color: var(--sp-accent);
	box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.sp-count {
	font-size: 11px;
	font-weight: 500;
	color: var(--sp-muted);
	background: var(--sp-bg);
	border: 1px solid var(--sp-border);
	border-radius: 999px;
	padding: 1px 8px;
	margin-left: auto;
	margin-right: 8px;
}

.sp-cards {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 6px;
	padding: 4px 0 10px;
}
.sp-root .sp-card {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 10px;
	min-width: 0;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	overflow: hidden;
	background: var(--sp-surface);
	border: 1px solid var(--sp-border);
	border-radius: 10px !important;
	padding: 8px 10px;
	text-align: left;
	font-size: 12.5px;
	font-weight: 500;
	line-height: 1.35;
	color: var(--sp-ink);
	box-shadow: var(--sp-shadow);
}
.sp-root .sp-card:hover {
	background: var(--sp-surface);
	color: var(--sp-ink);
	border-color: var(--sp-accent);
	box-shadow: var(--sp-shadow-lift);
}
/* Out-specify Elementor's high-specificity button rule (.elementor-NNNN
   .elementor-element-XXXX button{border-radius:0!important}) — match the same
   weight + an element selector so the rounded card corners win. */
.sp-root .sp-sidebar .sp-cards button.sp-card,
.sp-root .sp-sidebar .sp-cards button.sp-card-fixture {
	border-radius: 10px !important;
}
.sp-card img,
.sp-card-noimg {
	width: 46px;
	height: 46px;
	flex: 0 0 auto;
	object-fit: contain;
	border-radius: 6px;
	background: var(--sp-bg);
}
.sp-card-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1;
}
.sp-card-name {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.sp-card small {
	color: var(--sp-muted);
	font-size: 11px;
	font-weight: 400;
}
.sp-root .sp-card-fixture { padding: 10px; }
.sp-fixture-icon {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 8px;
	font-size: 17px;
	line-height: 1;
	flex: 0 0 auto;
	align-self: center;
}
.sp-root .sp-card-fixture {
	align-items: center;
	min-height: 54px;
}
.sp-card-fixture > span:last-child {
	flex: 1;
	align-self: center;
	margin-top: 4px;
}

/* ---------------------------------- stage ---------------------------------- */
.sp-stage-wrap {
	flex: 1;
	position: relative;
	border: 1px solid var(--sp-border);
	border-radius: var(--sp-radius);
	background: #f1ede6;
	overflow: hidden;
	min-height: 440px;
	box-shadow: var(--sp-shadow);
	/* Dragging items must not scroll the page on touch devices. */
	touch-action: none;
}

.sp-canvas-tools {
	position: absolute;
	top: 10px;
	left: 10px;
	display: flex;
	gap: 2px;
	background: var(--sp-surface);
	border: 1px solid var(--sp-border);
	border-radius: 10px;
	padding: 4px;
	box-shadow: var(--sp-shadow);
	z-index: 4;
}
.sp-root .sp-canvas-tools button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	font-size: 16px;
	border-radius: 7px;
	color: #57514a;
}
.sp-root .sp-canvas-tools button:hover:not(:disabled) {
	background: var(--sp-bg);
	color: var(--sp-ink);
}
.sp-root .sp-canvas-tools button:disabled {
	opacity: 0.35;
	cursor: default;
}
.sp-root .sp-canvas-tools button.is-active {
	background: var(--sp-accent);
	color: #fff;
}
.sp-root .sp-canvas-tools button.is-active:hover:not(:disabled) {
	background: #b45309;
	color: #fff;
}

/* "Show product photos" toggle in the Products step */
.sp-photos-row {
	margin: 0 0 12px;
	padding: 10px;
	background: var(--sp-bg);
	border: 1px solid var(--sp-border);
	border-radius: 8px;
}
.sp-root .sp-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--sp-ink);
	cursor: pointer;
}
.sp-root .sp-toggle input[type="checkbox"] {
	width: 16px;
	height: 16px;
	margin: 0;
	flex: 0 0 auto;
	accent-color: var(--sp-accent);
	cursor: pointer;
}
.sp-photos-note {
	margin-top: 8px !important;
	margin-bottom: 0;
	line-height: 1.3;
}
.sp-photos-note[hidden] { display: none; }

.sp-align-group {
	display: flex;
	gap: 2px;
	border-left: 1px solid var(--sp-border);
	border-right: 1px solid var(--sp-border);
	padding: 0 4px;
	margin: 0 2px;
}
.sp-align-group[hidden] { display: none; }

.sp-item-toolbar {
	position: absolute;
	display: flex;
	align-items: center;
	gap: 2px;
	background: var(--sp-surface);
	border: 1px solid var(--sp-border);
	border-radius: 10px;
	padding: 4px;
	box-shadow: var(--sp-shadow-lift);
	z-index: 5;
}
.sp-root .sp-item-toolbar button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	font-size: 16px;
	border-radius: 7px;
	color: #57514a;
}
.sp-root .sp-item-toolbar button:hover {
	background: var(--sp-bg);
	color: var(--sp-ink);
}
.sp-root .sp-item-toolbar .sp-tool-danger:hover {
	background: #fde8e8;
	color: #b42318;
}

/* ---------------------------------- legend ---------------------------------- */
.sp-legend {
	flex: 0 0 208px;
	border: 1px solid var(--sp-border);
	border-radius: var(--sp-radius);
	background: var(--sp-surface);
	box-shadow: var(--sp-shadow);
	padding: 14px;
	overflow-y: auto;
	max-height: 74vh;
}
.sp-legend h4 {
	margin: 0 0 8px;
	font-size: 13.5px;
	font-weight: 700;
	color: var(--sp-ink);
}
.sp-legend-row {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 7px 8px;
	border-radius: 8px;
	cursor: pointer;
	border: 1px solid transparent;
}
.sp-legend-row:hover { background: var(--sp-bg); }
.sp-legend-row.is-selected {
	border-color: var(--sp-accent);
	background: var(--sp-accent-soft);
}
.sp-root .sp-legend-row input[type="color"] {
	width: 26px;
	height: 26px;
	padding: 0;
	border: 1px solid var(--sp-border);
	border-radius: 7px;
	background: none;
	cursor: pointer;
	flex: 0 0 auto;
}
.sp-legend-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.sp-legend-row input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.sp-legend-icon {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 7px;
	background: var(--sp-bg);
	border: 1px solid var(--sp-border);
	font-size: 14px;
	color: #57514a;
	flex: 0 0 auto;
}
.sp-legend-body {
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
	flex: 1;
}
.sp-legend-name {
	font-size: 12px;
	font-weight: 500;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.sp-legend-body small {
	color: var(--sp-muted);
	font-size: 10.5px;
}

/* --------------------------------- tooltip --------------------------------- */
.sp-tip {
	position: absolute;
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--sp-ink);
	color: #fff;
	border-radius: 8px;
	padding: 7px 10px;
	font-size: 12.5px;
	max-width: 260px;
	z-index: 6;
	pointer-events: none;
	box-shadow: 0 6px 18px rgba(24, 20, 12, 0.3);
}
.sp-tip[hidden] { display: none; }
.sp-tip img {
	width: 38px;
	height: 38px;
	object-fit: contain;
	border-radius: 5px;
	background: #fff;
	flex: 0 0 auto;
}

/* ---------------------------------- toast ---------------------------------- */
.sp-toast {
	position: fixed;
	bottom: 28px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--sp-ink);
	color: #fff;
	padding: 11px 20px;
	border-radius: 999px;
	font-size: 13.5px;
	z-index: 9999;
	max-width: 90vw;
	box-shadow: 0 8px 24px rgba(24, 20, 12, 0.25);
}

/* Comfortable touch targets on coarse pointers regardless of width. */
@media (pointer: coarse) {
	.sp-root .sp-item-toolbar button {
		width: 42px;
		height: 42px;
		font-size: 19px;
	}
	.sp-sidebar summary { padding: 12px 2px; }
	.sp-root .sp-card { padding: 12px 8px; }
}

@media (max-width: 1080px) {
	.sp-legend { flex-basis: 170px; }
}

@media (max-width: 880px) {
	.sp-root { padding: 2px; font-size: 14px; }
	.sp-main { flex-direction: column; }
	/* Canvas first on small screens: tap a card below, item appears above. */
	.sp-stage-wrap { order: 1; min-height: 340px; }
	.sp-sidebar { order: 2; flex: none; max-height: 46vh; padding: 14px; }
	.sp-legend { order: 3; flex: none; max-height: 32vh; }
	.sp-step-name { display: none; }
	.sp-root .sp-step { padding: 6px 10px 6px 6px; }
	.sp-banner { padding: 9px 12px; font-size: 12.5px; }
	.sp-toast { bottom: 16px; font-size: 13px; }
}

@media (max-width: 480px) {
	.sp-steps { gap: 5px; }
	.sp-card img,
	.sp-card-noimg { width: 40px; height: 40px; }
	.sp-sidebar { max-height: 50vh; }
}
